Results for “integer”
Small, practical examples. Search by task or narrow things down below.
Extract part of a date
Read a calendar component with EXTRACT.
EXTRACT✓ Tested
Extract successive regex matches
Java: Use a Matcher loop to find all unsigned integer tokens in Java text.
Java✓ Tested
Find common factors and multiples
Python: Use the integer gcd and lcm helpers to avoid floating-point calculations.
Python✓ Tested
Find the greatest common divisor
Java: BigInteger.gcd calculates an exact nonnegative common divisor.
Java✓ Tested
Find the greatest common divisor with the standard library
C++: std::gcd computes a nonnegative integer common divisor.
C++✓ Tested
Find the largest array value
Track the maximum in a nonempty C integer array.
C✓ Tested
Find the least common multiple with the standard library
C++: std::lcm combines positive integer periods into a common cycle.
C++✓ Tested
Format whole seconds as hours minutes and seconds
JavaScript: Use integer divisions and remainders for a nonnegative duration.
JavaScript✓ Tested
Format whole seconds as hours minutes and seconds
TypeScript: Use integer divisions and remainders for a nonnegative duration.
TypeScript✓ Tested
Limit a value to a safe interval
Clamp an integer between chosen endpoints.
constrain✓ Tested
Parse a typed command-line option
Python: Use argparse to validate and convert an integer option.
Python✓ Tested
Read values from an inserted row
Use RETURNING to retrieve an automatically assigned row ID.
RETURNING✓ Tested