Results for “Numbers & numeric validation”
Small, practical examples. Search by task or narrow things down below.
Format a numeric label with leading zeroes
Bash Scripts: Use a constant printf format string and supply values as separate arguments.
Bash Scripts✓ Tested
Format a zero-padded numeric label
Linux Commands: Use printf formatting instead of concatenating a variable number of zeroes.
Linux Commands✓ Tested
Generate a sequence of numbers
Create rows without a stored table.
generate_series✓ Tested
Generate numbers with a recursive CTE
Build a bounded sequence using SQL recursion.
recursive CTE✓ Tested
Pad a numeric label
Convert a number to text and pad it to a fixed width.
JavaScript✓ Tested
Process items by numeric priority
C#: PriorityQueue removes the item with the smallest priority value first.
C#✓ Tested
Reject infinite and NaN numeric values
C++: std::isfinite excludes special floating-point values.
C++✓ Tested
Require numeric values on a chosen step
HTML: The step interval is measured from the minimum value when one is provided.
HTML✓ Tested
Return a descriptive validation error
Return a descriptive validation error using a complete Go program with explicit sample inputs.
Go✓ Tested
Run a Compose service as a numeric user
Docker / Compose: Run a Compose service as a numeric user in a small Compose file.
Docker / Compose✓ Tested
Run a one-off process with a numeric user ID
Docker / Compose: The user option overrides the image’s default identity.
Docker / Compose✓ Tested
Set copied files’ numeric ownership
Docker / Compose: COPY --chown sets ownership while adding the file.
Docker / Compose✓ Tested