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:

  1. z11
  2. z2

Natural sorting:

  1. z2
  2. 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]

ReferencesEdit

  1. ^ "Sorting for Humans : Natural Sort Order". blog.codinghorror.com.
  2. ^ "Natural Order Numerical Sorting".
  3. ^ "TidBITS: The Natural Order of Things".
  4. ^ "Dave Koelle's Alphanum Algorithm".
  5. ^ "Martin Pool's Natural Order String Comparison".
  6. ^ "PHP: natsort - Manual". php.net.
  7. ^ "Sort::Naturally - search.cpan.org". search.cpan.org.
  8. ^ Morton, Seth M. "natsort: Simple yet flexible natural sorting in Python" – via PyPI.
  9. ^ "Customizable Natural-Order Sort - File Exchange - MATLAB Central".
  10. ^ Kornblith, Simon. "NaturalSort: Natural Sort Order in Julia". github.com.

External linksEdit