Skip to content

stringDomain

const stringDomain: IntervalDomain<string>;

Defined in: interval-domains.ts:147

Strings in lexicographic (UTF-16 code-unit) order — CONTINUOUS. Useful for keyspace / shard ranges, prefix scans, alphabetical buckets, and geohash spatial ranges (geohashes sort lexicographically). Code-unit order, NOT locale-aware. No measure (no natural distance between strings).

NOTE: the [a,b] string form splits on the FIRST comma, so values containing , / [ / ] / ( / ) are not round-trippable via parse/toString (every other operation is unaffected).

import { parseInterval, stringDomain } from "@xtandard/lib/interval";
stringDomain.compare("Z", "a"); // -1 (code-unit order: uppercase sorts first)
parseInterval(stringDomain, "[a,n)").contains("mango"); // true