Results for “transform”
Small, practical examples. Search by task or narrow things down below.
Partition values into two collections
Partition values into two collections in a complete Rust program using the standard library.
Rust✓ Tested
Print a selected range of lines
Linux Commands: Use sed -n with a line address to suppress other output.
Linux Commands✓ Tested
Print the final lines of a file
Linux Commands: Use tail -n for a fixed-size suffix of a log.
Linux Commands✓ Tested
Read values until a condition changes
Read values until a condition changes in a complete Rust program using the standard library.
Rust✓ Tested
Remove adjacent duplicates from a sorted array
C: Compact equal neighbors with a write index after sorting or otherwise establishing order.
C✓ Tested
Remove blank or whitespace-only lines
Linux Commands: Use a POSIX character class so tabs and spaces are handled together.
Linux Commands✓ Tested
Remove carriage-return characters
Linux Commands: Use tr -d to remove CR characters from Windows-style line endings.
Linux Commands✓ Tested
Remove duplicate records by a selected key
C#: DistinctBy keeps the first record for each key in encounter order.
C#✓ Tested
Remove one array element and close the gap
C: memmove handles the overlap while the logical length shrinks by one.
C✓ Tested
Reorder fields with a capture group
Linux Commands: Use extended regular expressions and backreferences to rearrange a known format.
Linux Commands✓ Tested
Rotate a nonempty array left by one element
C: Save the first item before shifting the remaining elements.
C✓ Tested
Search a sorted array with bsearch
C: The search uses the same ordering comparator as the sorted input.
C✓ Tested