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

Build an object from key-value entries

TypeScript: Object.fromEntries converts an iterable of pairs into ordinary own properties.

TypeScript✓ Tested
JavaText validation & formatting

Build text efficiently in a loop

Java: Append to StringBuilder when constructing a string incrementally.

Java✓ Tested
CArray transformations

Calculate a cumulative sum for each position

C: Keep a running total and store each prefix result in a separate output array.

C✓ Tested
C#LINQ transformations

Calculate a product with Aggregate

C#: Supply a seed to define the result for an empty sequence.

C#✓ Tested
JavaStream transformations

Calculate several numeric stream statistics

Java: Use summaryStatistics to calculate count, sum, minimum, maximum, and average in one pass.

Java✓ Tested
JavaText validation & formatting

Check a filename suffix

Java: Use endsWith for a case-sensitive literal suffix test.

Java✓ Tested
JavaText validation & formatting

Check a string prefix

Java: Use startsWith to check a literal Java prefix without a regular expression.

Java✓ Tested
JavaStream transformations

Check any and all stream elements

Java: Use short-circuiting match operations for predicates over a Java collection.

Java✓ Tested
Linux CommandsTransforming text

Collapse repeated spaces

Linux Commands: Use tr -s when repeated occurrences of a character should become one.

Linux Commands✓ Tested
CBinary formats & structured parsing

Convert ASCII text to lowercase safely

C: Cast to unsigned char before calling ctype functions on a possibly signed char.

C✓ Tested
PowerShellStructured formats & encodings

Convert between hexadecimal text and bytes

PowerShell: Use the .NET hexadecimal helpers instead of parsing byte pairs manually.

PowerShell✓ Tested
C#JSON & binary formats

Convert bytes to Base64 and back

C#: Encode text to UTF-8 before converting it to a Base64 representation.

C#✓ Tested