FIND YOUR NEXT FEW LINES

Results for “Dates & numeric validation”

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

303 snippets foundClear filters
JavaText validation & formatting

Count Unicode code points

Java: Use codePointCount when supplementary characters should count as one rather than two UTF-16 units.

Java✓ Tested
JavaPrecise numeric calculations

Detect integer addition overflow

Java: Math.addExact throws rather than silently wrapping on overflow.

Java✓ Tested
C#Dates & precise numbers

Detect integer overflow with checked

C#: A checked arithmetic block throws instead of silently wrapping an integer result.

C#✓ Tested
PythonDates & time zones

Determine whether a year is a leap year

Python: Use calendar.isleap rather than a simplified divisibility-by-four check.

Python✓ Tested
PowerShellFunctions & parameter validation

Dispatch values with wildcard patterns

PowerShell: Switch -Wildcard interprets shell-style matching patterns for each clause.

PowerShell✓ Tested
GoDates & times

Display an instant at a fixed offset

Display an instant at a fixed offset using a complete Go program with explicit sample inputs.

Go✓ Tested
JavaPrecise numeric calculations

Display an integer as unsigned

Java: Use unsigned conversion methods when interpreting a fixed-width bit pattern.

Java✓ Tested
JavaPrecise numeric calculations

Divide decimal values with controlled precision

Java: Choose both scale and rounding for a quotient that does not terminate in base ten.

Java✓ Tested
JavaPrecise numeric calculations

Divide negative integers with floor rounding

Java: floorDiv and floorMod provide consistent floor-based quotient and remainder.

Java✓ Tested
PythonText validation & encoding

Encode and decode binary data as Base64

Python: Use Base64 when a text format must carry bytes; it is encoding, not encryption.

Python✓ Tested
C#Text validation & encoding

Enumerate Unicode code points

C#: EnumerateRunes combines surrogate pairs into Unicode scalar values.

C#✓ Tested
PythonText validation & encoding

Escape text for HTML content

Python: Use html.escape before placing plain text in an HTML text or quoted attribute context.

Python✓ Tested