Results for “C++”
Small, practical examples. Search by task or narrow things down below.
Use a literal value in a regular expression
PowerShell: Regex.Escape prevents a literal dot or other metacharacter from changing the match.
PowerShell✓ Tested
Use a small table variable
Declare rows for a short batch.
table variable✓ Tested
Use an alternate value only when a variable is nonempty
Bash Scripts: The colon-plus expansion returns its word only when the parameter has a nonempty value.
Bash Scripts✓ Tested
Use native required-field validation
Use native required-field validation with a small React component and explicit browser behavior.
React✓ Tested
Use the first fulfilled promise result
JavaScript: Promise.any ignores individual rejections until one input fulfills.
JavaScript✓ Tested
Use the first fulfilled promise result
TypeScript: Promise.any ignores individual rejections until one input fulfills.
TypeScript✓ Tested
Validate a required argument
Java: Use requireNonNull with a useful message at an API boundary.
Java✓ Tested
Validate an argument at a method boundary
C#: ThrowIfNegative gives callers an explicit argument error for an invalid range.
C#✓ Tested
Validate an entire identifier
Python: Use fullmatch so a regex must consume the complete input.
Python✓ Tested
Validate the number of positional arguments
Bash Scripts: Use the argument count to enforce a simple command-line contract.
Bash Scripts✓ Tested
Validate the shape of an absolute URL
HTML: A URL input checks syntax, not whether a resource exists or is safe.
HTML✓ Tested
Visit every reading in a fixed array
Arduino / C: Visit every reading in a fixed array on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested