10 stable releases

1.0.9 Aug 24, 2015
1.0.8 Mar 12, 2015
1.0.7 Jan 29, 2015
1.0.1 Dec 24, 2014
1.0.0 Nov 21, 2014

#101 in Algorithms

Download history 2779/week @ 2019-12-02 2198/week @ 2019-12-09 2398/week @ 2019-12-16 1705/week @ 2019-12-23 1246/week @ 2019-12-30 3008/week @ 2020-01-06 3835/week @ 2020-01-13 4194/week @ 2020-01-20 4174/week @ 2020-01-27 3863/week @ 2020-02-03 4227/week @ 2020-02-10 3445/week @ 2020-02-17 3365/week @ 2020-02-24 3165/week @ 2020-03-02 2866/week @ 2020-03-09 3542/week @ 2020-03-16

8,791 downloads per month
Used in 7 crates (5 directly)

MIT license

10KB
170 lines

Natord 1.0.9

Natord on Travis CI

Natural ordering for Rust. (also known as rust-natord) This allows for the comparison like this:

let mut files = vec!("rfc2086.txt", "rfc822.txt", "rfc1.txt");
files.sort_by(|&a, &b| natord::compare(a, b));
assert_eq!(files, ["rfc1.txt", "rfc822.txt", "rfc2086.txt"]);

It provides a compare and compare_ignore_case function for comparing strings, and also a compare_iter function for the customizable algorithm.

There are multiple natural ordering algorithms available. This version of natural ordering is inspired by Martin Pool's strnatcmp.c. See the test cases in the source code to see what it can do and it cannot.

Natord is written by Kang Seonghoon and licensed under the MIT/X11 license.

No runtime deps