Results for “Test-Path”
Small, practical examples. Search by task or narrow things down below.
Use a fallback for a missing hashtable entry
PowerShell: Test the key explicitly so legitimate false or zero values are preserved.
PowerShell✓ Tested
Use a literal value in a regular expression
PowerShell: Regex.Escape prevents a literal dot or other metacharacter from changing the match.
PowerShell✓ Tested
Write a multiline string without expanding variables
PowerShell: A single-quoted here-string preserves dollar signs literally.
PowerShell✓ Tested
Write a text file
Save a string to a UTF-8 text file and close the file automatically when the write finishes.
file✓ Tested
Write a UTF-8 file
Write a Java string to a file using an explicit text encoding.
Java✓ Tested
Write object records to a CSV file
PowerShell: Export-Csv uses property names as headers and quotes values when needed.
PowerShell✓ Tested
Write UTF-8 text to a file
Save a string without adding an extra newline.
Set-Content✓ Tested
Add a forgotten file to the latest unpublished commit
Git: Stage the missing file before amending without changing the message.
Git✓ Tested
Calculate a lexical relative path
C++: lexically_relative compares path components without requiring the paths to exist.
C++✓ Tested
Calculate the greatest common divisor
C: Euclid’s algorithm repeatedly replaces a pair with the divisor and remainder.
C✓ Tested
Change a path’s extension
Change a path’s extension in a complete Rust program using the standard library.
Rust✓ Tested
Combine the latest values from observables
Combine the latest values from observables with a standalone Angular component and explicit browser behavior.
Angular✓ Tested