Results for “Functions & parameter validation”
Small, practical examples. Search by task or narrow things down below.
Parse an integer with validation
Validate range and trailing characters when parsing a C integer with strtol.
C✓ Tested
Read a URL query parameter
Parse a URL with the standard JavaScript URL API.
JavaScript✓ Tested
Read an HTTP query parameter
Read an HTTP query parameter using a complete Go program with explicit sample inputs.
Go✓ Tested
Read positional parameters in a function
Bash Scripts: Read positional parameters in a function with a small standalone Bash program.
Bash Scripts✓ Tested
Replace text with parameter expansion
Bash Scripts: Replace text with parameter expansion with a small standalone Bash program.
Bash Scripts✓ Tested
Return a descriptive validation error
Return a descriptive validation error using a complete Go program with explicit sample inputs.
Go✓ Tested
Send query parameters as an object
jQuery: jQuery encodes the data object into the request query.
jQuery✓ Tested
Show a field-specific validation message
Show a field-specific validation message with a small React component and explicit browser behavior.
React✓ Tested
Style a control that fails native validation
CSS: Invalid reflects the input’s current constraint-validation result.
CSS✓ Tested
Use native required-field validation
Use native required-field validation with a small React component and explicit browser behavior.
React✓ Tested
Build a URL query string
Python: Use urlencode to percent-encode query parameter values correctly.
Python✓ Tested
Raise and catch a domain-specific exception
Python: Give a validation failure its own exception type so callers can handle it narrowly.
Python✓ Tested