FIND YOUR NEXT FEW LINES

Results for “to”

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

3000 snippets foundClear filters
AngularEvents & DOM interaction

Validate a field when focus leaves it

Validate a field when focus leaves it with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
JavaScriptNumbers & numeric validation

Validate a finite numeric value without coercion

JavaScript: Number.isFinite rejects numeric strings as well as NaN and infinity.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Validate a finite numeric value without coercion

TypeScript: Number.isFinite rejects numeric strings as well as NaN and infinity.

TypeScript✓ 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
Arduino / CEEPROM & program memory

Validate a small stored payload with a checksum

Arduino / C: Store a checksum with the payload and reject a changed byte.

Arduino / C✓ Tested
HTMLInput constraints

Validate a structured text identifier

HTML: The pattern attribute matches the entire nonempty input; required handles the empty case.

HTML✓ Tested
JavaScriptRegular expressions & URL encoding

Validate a whole ASCII identifier

JavaScript: Use an anchored expression without the multiline flag and reject a trailing line break explicitly.

JavaScript✓ Tested
TypeScriptRegular expressions & URL encoding

Validate a whole ASCII identifier

TypeScript: Use an anchored expression without the multiline flag and reject a trailing line break explicitly.

TypeScript✓ Tested
ReactContext & shared state

Validate access through a custom context hook

Validate access through a custom context hook with a small React component and explicit browser behavior.

React✓ 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
HTMLForms

Validate an email input

Use browser constraint validation for a required HTML email field.

HTML✓ Tested