locale, e.g. en
or de
.
true
, if strings should be compared ignoring case, otherwise false
.
comparator for comparing strings with numeric parts
const comparator = createStringWithNumberPartsComparator();
const values = ["a1", "a10", "a2", "b1, "a20", "a3"];
values.sort(comparator);
assert.deepStrictEqual(["a1", "a2", "a3", "a10", "a20", "b1"], values);
Generated using TypeDoc
Factory to create a string comparator which compares strings respecting numeric parts of the given strings. The comparator splits the input into string and numeric parts to compare them separately.