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
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
RustNumbers & durations

Express a duration in milliseconds

Express a duration in milliseconds in a complete Rust program using the standard library.

Rust✓ Tested
C++Text validation & parsing

Extract a substring with an explicit count

C++: The second substr argument is a length rather than an ending index.

C++✓ Tested
C#Text validation & encoding

Extract a substring with range syntax

C#: C# range ends are exclusive; indices operate on UTF-16 code units.

C#✓ Tested
C#Text validation & encoding

Extract all integer tokens from text

C#: Enumerate Match objects returned by Regex.Matches with an explicit timeout.

C#✓ Tested
PythonText validation & encoding

Extract named regex fields

Python: Use named capture groups to parse a known date-shaped identifier.

Python✓ Tested
JavaText validation & formatting

Extract successive regex matches

Java: Use a Matcher loop to find all unsigned integer tokens in Java text.

Java✓ Tested
JavaText validation & formatting

Extract text between known positions

Java: Java substring uses a start-inclusive, end-exclusive range of UTF-16 indices.

Java✓ Tested
PythonNumbers & calculations

Find common factors and multiples

Python: Use the integer gcd and lcm helpers to avoid floating-point calculations.

Python✓ Tested
JavaPrecise numeric calculations

Find the greatest common divisor

Java: BigInteger.gcd calculates an exact nonnegative common divisor.

Java✓ Tested
C++Numeric parsing & calculations

Find the greatest common divisor with the standard library

C++: std::gcd computes a nonnegative integer common divisor.

C++✓ Tested
C++Numeric parsing & calculations

Find the least common multiple with the standard library

C++: std::lcm combines positive integer periods into a common cycle.

C++✓ Tested