1 unstable release

0.1.0 Mar 26, 2023

#1548 in Text processing

Download history 2236/week @ 2023-12-16 1494/week @ 2023-12-23 1720/week @ 2023-12-30 2493/week @ 2024-01-06 3671/week @ 2024-01-13 3503/week @ 2024-01-20 3217/week @ 2024-01-27 3129/week @ 2024-02-03 4097/week @ 2024-02-10 4640/week @ 2024-02-17 3543/week @ 2024-02-24 3204/week @ 2024-03-02 3405/week @ 2024-03-09 4324/week @ 2024-03-16 4241/week @ 2024-03-23 2991/week @ 2024-03-30

15,369 downloads per month
Used in 47 crates (5 directly)

MIT/Apache

30KB
542 lines

lexicmp

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.

docs.rs Crates.io

Features

  • Compare strings lexicographically
  • Compare strings naturally with support for numbers
  • Compare strings sensitively and case insensitively
  • Compare strings, skipping non-alphanumeric characters
  • Compare strings lexicographically and naturally together
  • Handle unicode characters, foreign languages, and emoji characters
  • Does not allocate memory on the heap, instead using iterators

Original

This code is forked originally from lexical-sort, licensed under the Apache 2.0 and MIT licenses.

Dependencies

~240KB