FIND YOUR NEXT FEW LINES

Results for “tr”

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

1534 snippets foundClear filters
JavaRecords & reliable control flow

Update a shared counter atomically

Java: AtomicInteger provides an indivisible increment operation for a shared counter.

Java✓ Tested
C#Collections & data structures

Use a last-in first-out stack

C#: Stack is useful for reversible traversal and other nested operations.

C#✓ Tested
PowerShellStrings & literal text

Use a literal value in a regular expression

PowerShell: Regex.Escape prevents a literal dot or other metacharacter from changing the match.

PowerShell✓ Tested
C#Types & reliable control flow

Use a switch expression to classify a value

C#: Relational patterns express a small ordered range classification.

C#✓ Tested
CFile positioning & lifecycle

Use an automatically removed temporary file

C: tmpfile creates a binary update stream whose file is removed when closed.

C✓ Tested
C#Collections & data structures

Use case-insensitive dictionary keys

C#: Choose an ordinal comparer when case-insensitive keys represent identifiers.

C#✓ Tested
Arduino / CSerial protocols

Validate a complete numeric serial command

Arduino / C: Check for digits, an end pointer, and an application-specific range.

Arduino / C✓ Tested
jQueryEvent control

Validate a field when focus leaves it

jQuery: focusout bubbles and can support delegated form validation.

jQuery✓ Tested
JavaRecords & reliable control flow

Validate a required argument

Java: Use requireNonNull with a useful message at an API boundary.

Java✓ Tested
CBinary formats & structured parsing

Validate a simple C-style ASCII identifier

C: Check the first character separately from subsequent characters and reject empty input.

C✓ Tested
C#Types & reliable control flow

Validate an argument at a method boundary

C#: ThrowIfNegative gives callers an explicit argument error for an invalid range.

C#✓ Tested
HTMLInput constraints

Validate the shape of an absolute URL

HTML: A URL input checks syntax, not whether a resource exists or is safe.

HTML✓ Tested