Crate natord [] [src]

Natord 1.0.9

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"]);

There are multiple natural ordering algorithms available. This version of natural ordering is inspired by Martin Pool's strnatcmp.c.

Functions

compare

Compares two strings case-sensitively. It skips any Unicode whitespaces and handles a series of decimal digits.

compare_ignore_case

Compares two strings case-insensitively. It skips any Unicode whitespaces and handles a series of decimal digits.

compare_iter

Compares two iterators of "characters" possibly containing "digits". The natural ordering can be customized with the following parameters: