Results for “Strings & literal text”
Small, practical examples. Search by task or narrow things down below.
Handle a filename pattern with no matches
Use nullglob so an unmatched pattern produces an empty array.
nullglob✓ Tested
Handle a result with a discriminated union
Separate success data from an error message.
discriminated union✓ Tested
Inspect a parsed URI
C#: Use Uri properties instead of splitting URL strings manually.
C#✓ Tested
Join transformed stream values
Java: Use Collectors.joining after converting elements to strings.
Java✓ Tested
Keep a decorative icon out of a button’s name
HTML: aria-hidden excludes a decorative character while leaving the visible action text as the accessible name.
HTML✓ Tested
Limit a numeric input to an inclusive range
HTML: Number inputs expose range validation separately from the entered text.
HTML✓ Tested
List matching files
Enumerate immediate text files and sort their names in C#.
C#✓ Tested
Match one of several values
Use IN to avoid repeating equality conditions.
IN✓ Tested
Measure a string length
Count bytes before the null terminator with C strlen.
C✓ Tested
Narrow a union using typeof
Handle text and numeric values with separate branches.
union✓ Tested
Number a sorted result
Assign a row number without changing stored data.
row_number✓ Tested
Number rows within each group
Assign ordered row numbers with a window function.
row_number✓ Tested