Results for “Strings & literal text”
Small, practical examples. Search by task or narrow things down below.
Discard incidental output from a setup command
PowerShell: Out-Null prevents setup objects from becoming part of a function or script’s useful result.
PowerShell✓ Tested
Distinguish UTF-8 bytes from characters
Distinguish UTF-8 bytes from characters in a complete Rust program using the standard library.
Rust✓ Tested
Encode and decode binary data as Base64
Python: Use Base64 when a text format must carry bytes; it is encoding, not encryption.
Python✓ Tested
Enumerate Unicode code points
C#: EnumerateRunes combines surrogate pairs into Unicode scalar values.
C#✓ Tested
Exclude matching lines
Linux Commands: Use grep -v to retain lines that do not start with a comment marker.
Linux Commands✓ Tested
Extract a section of an Arduino String
Arduino / C: substring includes the start index and excludes the end index.
Arduino / C✓ Tested
Extract a substring with an explicit count
C++: The second substr argument is a length rather than an ending index.
C++✓ Tested
Extract a substring with range syntax
C#: C# range ends are exclusive; indices operate on UTF-16 code units.
C#✓ Tested
Extract named regex fields
Python: Use named capture groups to parse a known date-shaped identifier.
Python✓ Tested
Extract part of a string
Use one-based positions with substr.
substr✓ Tested
Extract successive regex matches
Java: Use a Matcher loop to find all unsigned integer tokens in Java text.
Java✓ Tested
Find the final path separator
C: strrchr locates the last matching character without modifying the input.
C✓ Tested