Natural sort order
Natural sort order is an ordering of strings in alphabetical order, except that multi-digit numbers are treated atomically, i.e., as if they were a single character. Natural sort order has been promoted as being more human-friendly ("natural") than the machine-oriented pure alphabetical order.[1]
For example, in alphabetical sorting "z11" would be sorted before "z2" because "1" is sorted as smaller than "2", while in natural sorting "z2" is sorted before "z11" because "2" is sorted as smaller than "11".
Alphabetical sorting:
- z11
- z2
Natural sorting:
- z2
- z11
The Natural Order Mac OS System Extension was conceived and implemented overnight on-site as an entry for the Best Hack contest during the 1996 MacHack conference in Dearborn, Michigan.[2][3]
Dave Koelle wrote the Alphanum Algorithm in 1997[4] and Martin Pool published Natural Order String Comparison in 2000.[5]
Functionality to sort by natural sort order is now widely available in software libraries for many programming languages.[6][7][8][9][10]
References
- "Sorting for Humans : Natural Sort Order". blog.codinghorror.com.
- "Natural Order Numerical Sorting".
- "TidBITS: The Natural Order of Things".
- "Dave Koelle's Alphanum Algorithm".
- "Martin Pool's Natural Order String Comparison".
- "PHP: natsort - Manual". php.net.
- "Sort::Naturally - search.cpan.org". search.cpan.org.
- Morton, Seth M. "natsort: Simple yet flexible natural sorting in Python" – via PyPI.
- "Customizable Natural-Order Sort - File Exchange - MATLAB Central".
- Kornblith, Simon. "NaturalSort: Natural Sort Order in Julia". github.com.
External links
- Alphabetizer Natural Sort Order.