Natural sorting: Difference between revisions

m
added whitespace so that the "sample input" in the task's preamble displays at full width.
m (→‎{{header|AppleScript}}: Typo correction.)
m (added whitespace so that the "sample input" in the task's preamble displays at full width.)
Line 6:
order of individual characters codes to make the finding of
individual strings easier for a ''human'' reader.
 
 
There is no "one true way" to do this, but for the purpose of this task 'natural' orderings might include:
Line 11 ⟶ 12:
:2. Make all whitespace characters equivalent.
:3. Sorting without regard to case.
:4. Sorting numeric portions of strings in numeric order. That is split the string into fields on numeric boundaries, then sort on each field, with the rightmost fields being the most significant, and numeric fields of integers treated as numbers.
:: That is split the string into fields on numeric boundaries, then sort on each field, with the rightmost fields being the most significant, and numeric fields of integers treated as numbers.
:: foo9.txt before foo10.txt
:: As well as ... x9y99 before x9y100, before x10y0
Line 24 ⟶ 26:
:: Sort ʒ, LATIN SMALL LETTER EZH as s
:: ...
 
 
;Task Description
Line 31 ⟶ 34:
 
* '''For extra credit''' implement more than the first four.
 
Note: It is not necessary to have individual control of which features are active in the natural sorting routine at any time.
 
 
;Sample input: