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
C++Numeric parsing & calculations

Parse a complete integer without exceptions

C++: from_chars reports both an error code and the first unconsumed character.

C++✓ Tested
C#Dates & precise numbers

Parse a date without a time component

C#: DateOnly avoids attaching an irrelevant time or timezone to a calendar date.

C#✓ Tested
C++Numeric parsing & calculations

Parse a hexadecimal integer with from_chars

C++: An explicit radix controls digit interpretation without a locale dependency.

C++✓ Tested
GoErrors & validation

Parse an email address syntax

Parse an email address syntax using a complete Go program with explicit sample inputs.

Go✓ Tested
JavaPrecise numeric calculations

Parse an integer in another base

Java: Supply an explicit radix to Integer.parseInt.

Java✓ Tested
CNumeric parsing & arithmetic

Parse an unsigned hexadecimal integer

C: Use an explicit base and check both range and full consumption.

C✓ Tested
PowerShellFunctions & parameter validation

Pass a block of behavior as an argument

PowerShell: Invoke a scriptblock with the call operator and an explicit input value.

PowerShell✓ Tested
PowerShellFunctions & parameter validation

Preserve a failure after local cleanup

PowerShell: A bare throw inside catch rethrows the current exception.

PowerShell✓ Tested
JavaText validation & formatting

Process the lines of an in-memory string

Java: Use String.lines to handle common line terminators without retaining them.

Java✓ Tested
C#Text validation & encoding

Quote a literal search term for a regex

C#: Regex.Escape prevents metacharacters in a literal term from changing the pattern.

C#✓ Tested
C++Text validation & parsing

Read a quoted string containing spaces

C++: The quoted manipulator extracts a quoted field without splitting at internal spaces.

C++✓ Tested
ReactForms & validation

Read an uncontrolled form with FormData

Read an uncontrolled form with FormData with a small React component and explicit browser behavior.

React✓ Tested