FIND YOUR NEXT FEW LINES

Results for “Strings & literal text”

Small, practical examples. Search by task or narrow things down below.

495 snippets foundClear filters
Bash ScriptsFiles & reliability

Handle a filename pattern with no matches

Use nullglob so an unmatched pattern produces an empty array.

nullglob✓ Tested
TypeScriptSafe data handling

Handle a result with a discriminated union

Separate success data from an error message.

discriminated union✓ Tested
C#Asynchronous work & URI handling

Inspect a parsed URI

C#: Use Uri properties instead of splitting URL strings manually.

C#✓ Tested
JavaStream transformations

Join transformed stream values

Java: Use Collectors.joining after converting elements to strings.

Java✓ Tested
HTMLAccessible structure

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
HTMLInput constraints

Limit a numeric input to an inclusive range

HTML: Number inputs expose range validation separately from the entered text.

HTML✓ Tested
C#Files & paths

List matching files

Enumerate immediate text files and sort their names in C#.

C#✓ Tested
SQLSelect & filter

Match one of several values

Use IN to avoid repeating equality conditions.

IN✓ Tested
CStrings

Measure a string length

Count bytes before the null terminator with C strlen.

C✓ Tested
TypeScriptTypes & functions

Narrow a union using typeof

Handle text and numeric values with separate branches.

union✓ Tested
SQLiteQueries & text

Number a sorted result

Assign a row number without changing stored data.

row_number✓ Tested
PostgresWindows & text

Number rows within each group

Assign ordered row numbers with a window function.

row_number✓ Tested