FIND YOUR NEXT FEW LINES

Results for “Forms & validation”

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

152 snippets foundClear filters
C++Text validation & parsing

Check a literal suffix in C++17

C++: Check lengths before subtracting to avoid an unsigned underflow.

C++✓ Tested
JavaText validation & formatting

Check a string prefix

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

Java✓ Tested
C#Text validation & encoding

Check an extension without case sensitivity

C#: Use an explicit ordinal case-insensitive comparison for a known filename suffix.

C#✓ Tested
jQueryForm serialization & state

Check native form validity before proceeding

jQuery: Use the native checkValidity API from the selected form.

jQuery✓ Tested
JavaScriptNumbers & numeric validation

Check whether a value is a safe integer

JavaScript: Number.isSafeInteger also checks the exact-integer range supported by Number.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Check whether a value is a safe integer

TypeScript: Number.isSafeInteger also checks the exact-integer range supported by Number.

TypeScript✓ Tested
Bash ScriptsLoops & decisions

Check whether input is a nonnegative integer

Reject empty input and nonnumeric characters before arithmetic.

validation✓ Tested
JavaScriptNumbers & numeric validation

Clamp a number between inclusive bounds

JavaScript: Combine Math.min and Math.max when lower is no greater than upper.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Clamp a number between inclusive bounds

TypeScript: Combine Math.min and Math.max when lower is no greater than upper.

TypeScript✓ Tested
PowerShellDates & numeric validation

Clamp a number to inclusive bounds

PowerShell: Math.Clamp chooses the nearest endpoint for an out-of-range value.

PowerShell✓ Tested
JavaScriptNumbers & numeric validation

Compare bounded floating-point results with a tolerance

JavaScript: Use an absolute error threshold for values known to be near one.

JavaScript✓ Tested
TypeScriptNumbers & numeric validation

Compare bounded floating-point results with a tolerance

TypeScript: Use an absolute error threshold for values known to be near one.

TypeScript✓ Tested