Crates.io | lexicmp |
lib.rs | lexicmp |
version | 0.1.0 |
source | src |
created_at | 2023-03-26 21:06:48.571771 |
updated_at | 2023-03-26 21:06:48.571771 |
description | Library for comparing and sorting strings lexicographically and naturally |
homepage | https://github.com/surrealdb/lexicmp |
repository | https://github.com/surrealdb/lexicmp |
max_upload_size | |
id | 821526 |
size | 46,498 |
The lexicmp library enables comparing and sorting strings using lexicographical and natural sorting semantics. This means that any Unicode characters such as á
or ß
are treated like their closest ASCII character: á
is treated as a
, ß
is treated as ss
. This library also ensures that emojis are transliterated before being sorted. When using natural sorting, numbers are sorted naturally, ensuring that 50
is sorted before 100
, skipping characters that aren't alphanumeric, ensuring that f-5
is next to f5
. If different strings have the same ASCII representation (e.g. "Foo"
and "fóò"
), it falls back to the default method from the standard library, ensuring that sorting is always deterministic, and constitute a total order.
This code is forked originally from lexical-sort, licensed under the Apache 2.0 and MIT licenses.