Skip to content

Compares

[Source]

primitive val Compares

Constructors

create

[Source]

new val create()
: Compares val^

Returns


Public Functions

bytes

[Source]

Lexicographic byte comparison. Total. Result is in the codepoint order if both inputs are well-formed UTF-8, since UTF-8's byte-sort order matches codepoint order.

fun box bytes(
  a: String box,
  b: String box)
: Compare

Parameters

Returns


equal_bytes

[Source]

True iff a and b are byte-for-byte equal. Distinct from equal_canonical: "café" precomposed (5 bytes) and "café" decomposed (6 bytes) are NOT byte-equal but ARE canonically equal.

fun box equal_bytes(
  a: String box,
  b: String box)
: Bool val

Parameters

Returns


equal_canonical

[Source]

NFC-equality: true iff NFC(a) == NFC(b) byte-for-byte.

fun box equal_canonical(
  a: String box,
  b: String box)
: (Bool val | InvalidUtf8 val)

Parameters

Returns


equal_compat

[Source]

NFKC-equality. Folds compatibility variants (e.g., fi ligature equals 'fi'; full-width digits equal ASCII digits).

fun box equal_compat(
  a: String box,
  b: String box)
: (Bool val | InvalidUtf8 val)

Parameters

Returns


equal_caseless

[Source]

Default caseless equality: fold(a) == fold(b). Ignores case differences but NOT canonical differences.

fun box equal_caseless(
  a: String box,
  b: String box)
: (Bool val | InvalidUtf8 val)

Parameters

Returns


equal_caseless_canonical

[Source]

UAX #21 D146 default caseless matching: NFD(fold(NFD(a))) == NFD(fold(NFD(b))). Ignores both case and canonical differences. The double-NFD is required because case folding can produce non-NFD output.

fun box equal_caseless_canonical(
  a: String box,
  b: String box)
: (Bool val | InvalidUtf8 val)

Parameters

Returns


eq

[Source]

fun box eq(
  that: Compares val)
: Bool val

Parameters

Returns


ne

[Source]

fun box ne(
  that: Compares val)
: Bool val

Parameters

Returns