FIND YOUR NEXT FEW LINES

Results for “Form behavior”

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

1212 snippets foundClear filters
TypeScriptObject behavior & collections

Remove a Map entry and detect whether it existed

TypeScript: Map.delete returns true only when an entry was present.

TypeScript✓ Tested
CArray transformations

Remove adjacent duplicates from a sorted array

C: Compact equal neighbors with a write index after sorting or otherwise establishing order.

C✓ Tested
Linux CommandsTransforming text

Remove blank or whitespace-only lines

Linux Commands: Use a POSIX character class so tabs and spaces are handled together.

Linux Commands✓ Tested
Linux CommandsTransforming text

Remove carriage-return characters

Linux Commands: Use tr -d to remove CR characters from Windows-style line endings.

Linux Commands✓ Tested
C#LINQ transformations

Remove duplicate records by a selected key

C#: DistinctBy keeps the first record for each key in encounter order.

C#✓ Tested
CArray transformations

Remove one array element and close the gap

C: memmove handles the overlap while the logical length shrinks by one.

C✓ Tested
Linux CommandsTransforming text

Reorder fields with a capture group

Linux Commands: Use extended regular expressions and backreferences to rearrange a known format.

Linux Commands✓ Tested
JavaText validation & formatting

Repeat text a fixed number of times

Java: Use String.repeat with a nonnegative repetition count.

Java✓ Tested
CArray transformations

Rotate a nonempty array left by one element

C: Save the first item before shifting the remaining elements.

C✓ Tested
CArray transformations

Search a sorted array with bsearch

C: The search uses the same ordering comparator as the sorted input.

C✓ Tested
CBinary formats & structured parsing

Serialize a 16-bit integer in big-endian order

C: Explicit shifts make a byte format independent of the CPU’s native byte order.

C✓ Tested
PowerShellStructured formats & encodings

Serialize nested objects with an explicit depth

PowerShell: Select a sufficient depth so nested data is retained instead of converted into a descriptive string.

PowerShell✓ Tested