Results for “first lines”
Small, practical examples. Search by task or narrow things down below.
Remove duplicate values with a Set
Keep the first occurrence order while deduplicating.
Set✓ Tested
Remove duplicates from a list
Remove repeated hashable values while preserving the order in which they first appeared.
list✓ Tested
Replace all matching text
Normalize repeated whitespace with a regular expression.
regexp_replace✓ Tested
Replace NULL in a result
Choose a fallback for a missing value.
COALESCE✓ Tested
Rotate a nonempty array left by one element
C: Save the first item before shifting the remaining elements.
C✓ Tested
Rotate a sequence around a selected position
C++: rotate places the element at the middle iterator first while preserving the two segment orders.
C++✓ Tested
Run an event handler once
Use jQuery one for a handler that removes itself after the first event.
jQuery✓ Tested
Search for text in a file
Find matching lines with their line numbers, ignoring letter case and treating the pattern as literal text.
grep✓ Tested
Share data through a named volume
Keep a file across two short-lived containers.
volume✓ Tested
Substitute a value for NULL
Use SQL Server’s ISNULL expression.
ISNULL✓ Tested
Trim surrounding ASCII whitespace
C++: Find the first and last non-whitespace bytes before taking a substring.
C++✓ Tested
Undo a multi-row transfer atomically
SQL: The first transaction commits the fixtures. Rolling back the second transaction restores both sides of the attempted transfer.
SQL✓ Tested