alphanumericCompare
Function which, given two strings, the type of comparison to be verified, and optional options, performs the comparison between the two strings and returns a boolean indicating whether the indicated comparison is respected or not.
Types
AlphanumericCompareProps
Parameters accepted by all overloads of alphanumericCompare.
| Property | Type | Required | Description |
|---|---|---|---|
string1 | string | ✓ | The first string to compare. |
string2 | string | ✓ | The second string to compare. |
compareType | "<" \| ">" \| "=" \| ">=" \| "<=" | Controls the return type and comparison mode: - undefined (default) — Returns a numeric sort order value (-1, 0, or 1), following the same semantics as Intl.Collator.prototype.compare. - "<" | ">" | "=" | ">=" | "<=" — Returns a boolean indicating whether the comparison satisfies the given operator. | |
locales | Intl.LocalesArgument | A BCP 47 language tag or array of tags forwarded to Intl.Collator. Determines locale-sensitive string ordering rules (e.g. "en", "de", "it"). When omitted, the runtime default locale is used. | |
opts | Intl.CollatorOptions | Options forwarded to the Intl.Collator constructor, allowing fine-grained control over sensitivity, case handling, numeric ordering, and more. See {@link Intl.CollatorOptions}. |
