numeric_range

Last updated:

0 purchases

numeric_range Image
numeric_range Images
Add to Cart

Description:

numeric range

Numeric range #
Lightweight utility class providing interval-like operations as implemented e.g. also by
math_expressions. This package offers a type-safe
int-only version though, as well as exposing a dedicated API for intersecting ranges.
/// create an instance - for integer-only operations, import from [integer_range.dart]
const fourToFive = Range(4, 5);

/// in-range check
fourToFive.contains(4); // true
fourToFive.contains(7); // false

/// intersecting
fourToFive.intersection(Range(3.9, 5.1)); // still [4..5]
/// shorthand notation for intersection
fourToFive & NumRange(3.9, 4.9); // [4..4.9]

/// equality
Range(4, 8).intersection(Range(3, 6)) == Range(4, 6); // true
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.