freebsd-ports/textproc/p5-Sort-Naturally/pkg-descr
Stefan Eßer fb16dfecae Remove WWW entries moved into port Makefiles
Commit b7f05445c0 has added WWW entries to port Makefiles based on
WWW: lines in pkg-descr files.

This commit removes the WWW: lines of moved-over URLs from these
pkg-descr files.

Approved by:		portmgr (tcberner)
2022-09-07 23:58:51 +02:00

25 lines
1.3 KiB
Text

This module exports two functions, nsort and ncmp; they are used in implementing
my idea of a "natural sorting" algorithm. Under natural sorting, numeric
substrings are compared numerically, and other word-characters are compared
lexically.
This is the way I define natural sorting:
* Non-numeric word-character substrings are sorted lexically,
case-insensitively: "Foo" comes between "fish" and "fowl".
* Numeric substrings are sorted numerically: "100" comes after "20",
not before.
* \W substrings (neither words-characters nor digits) are ignored. Our use
* of \w, \d, \D, and \W is locale-sensitive: Sort::Naturally
uses a use locale statement.
* When comparing two strings, where a numeric substring in one place
is not up against a numeric substring in another, the non-numeric always comes
first. This is fudged by reading pretending that the lack of a number substring
has the value -1, like so:
* The start of a string is exceptional: leading non-\W (non-word,
non-digit) components are ignored, and numbers come before letters.
* I define "numeric substring" just as sequences matching m/\d+/ --
scientific notation, commas, decimals, etc., are not seen. If your data has
thousands separators in numbers ("20,000 Leagues Under The Sea" or "20.000
lieues sous les mers"), consider stripping them before feeding them to nsort or
ncmp.