FIND YOUR NEXT FEW LINES

Results for “Numbers & numeric validation”

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

266 snippets foundClear filters
Arduino / CGetting Started

Give an LED pin a constant name

Arduino / C: Use const to name the built-in LED pin and reuse it in output instructions.

Arduino / C✓ Tested
HTMLInput constraints

Limit typed text to a maximum length

HTML: Maxlength limits ordinary user editing without replacing server-side validation.

HTML✓ Tested
TypeScriptTypes & functions

Narrow a union using typeof

Handle text and numeric values with separate branches.

union✓ Tested
PostgresWindows & text

Number rows within each group

Assign ordered row numbers with a window function.

row_number✓ Tested
PowerShellStrings & literal text

Pad a label with leading zeroes

PowerShell: Use a numeric format specifier to control the displayed width.

PowerShell✓ Tested
JavaNumbers & dates

Parse an integer safely

Handle invalid Java integer input with NumberFormatException.

Java✓ Tested
PythonFunctions & error handling

Raise and catch a domain-specific exception

Python: Give a validation failure its own exception type so callers can handle it narrowly.

Python✓ Tested
Arduino / CSerial protocols

Read an integer from serial input

Arduino / C: parseInt skips leading nonnumeric characters and reads the next integer.

Arduino / C✓ Tested
JavaScriptRegular expressions & URL encoding

Read named regex capture groups

JavaScript: Named groups make a fixed input format easier to inspect than numeric group positions.

JavaScript✓ Tested
TypeScriptRegular expressions & URL encoding

Read named regex capture groups

TypeScript: Named groups make a fixed input format easier to inspect than numeric group positions.

TypeScript✓ Tested
HTMLInput constraints

Require a nonempty text value

HTML: The required attribute makes an empty text control fail native constraint validation.

HTML✓ Tested
SQLConstraints & defaults

Require a value with NOT NULL

SQL: Declare required fields at the database boundary, not only in application validation.

SQL✓ Tested