IntX extension
Core extensions on int adding digits access and iterative range utilities.
- on
Properties
- digitCount → int
-
Available on int, provided by the IntX extension
Number of decimal digits (ignores sign). Safe against integer overflows.no setter -
digits
→ List<
int> -
Available on int, provided by the IntX extension
Individual digits, most-significant first. Optimized mathematically.no setter - factorial → int
-
Available on int, provided by the IntX extension
Factorial of this value.no setter - isNegative → bool
-
Available on int, provided by the IntX extension
Returns true if this value is negative.no setter - isPositive → bool
-
Available on int, provided by the IntX extension
Returns true if this value is positive.no setter - isPowerOfTwo → bool
-
Available on int, provided by the IntX extension
Whether this value is an exact power of two.no setter - isPrime → bool
-
Available on int, provided by the IntX extension
Whether this value is a prime number.no setter - isZero → bool
-
Available on int, provided by the IntX extension
Returns true if this value is zero.no setter - nonNegative → int
-
Available on int, provided by the IntX extension
Returns this value clamped to zero or above.no setter - nonPositive → int
-
Available on int, provided by the IntX extension
Returns this value clamped to zero or below.no setter
Methods
-
clampInt(
int min, int max) → int -
Available on int, provided by the IntX extension
Returns this value constrained to the inclusive range [min,max]. -
isBetween(
int min, int max) → bool -
Available on int, provided by the IntX extension
Returns true if this value is betweenminandmaxinclusively. -
isDivisibleBy(
int divisor) → bool -
Available on int, provided by the IntX extension
Returns true if this value is evenly divisible bydivisor. -
isMultipleOf(
int factor) → bool -
Available on int, provided by the IntX extension
Returns true if this value is a multiple offactor. -
lcm(
int other) → int -
Available on int, provided by the IntX extension
Least common multiple of this value andother. -
times(
void action()) → void -
Available on int, provided by the IntX extension
Executesactionexactlythistimes. Equivalent to aforloop. -
timesIndexed(
void action(int index)) → void -
Available on int, provided by the IntX extension
Executesactionwith the current zero-based index exactlythistimes. -
to(
int end, {int step = 1}) → Iterable< int> - Inclusive range as a lazy iterable. Handles both ascending and descending ranges.