Talk:Natural sorting: Difference between revisions
Undo revision 245761 by Petelomax (talk)
Line 14:
# Split the string into fields of alternating numeric/non-numeric runs of characters (or non-numeric/numeric).
# when comparing two strings s1 and s2 say, now split as fields, start from the rightmost fields and compare them - if the first fields are numeric then compare them as integers; if the fields are both non-numeric then compare them as character strings; if they differ in type then assume any integer field is always less than any non-integer field (the two strings shouldn't really be compared, but this gives them a defined order).
# If the two rightmost
# If the fields of the two strings compare equal so far, but one string has no more fields but the other has more fields, then the string with least fields is the smaller.
Using the above comparison rules you should be able to sort/order strings. --[[User:Paddy3118|Paddy3118]] 19:11, 23 April 2011 (UTC)
Line 70:
I would expect the natural sort to give the reverse order, based on evaluating the groups from the right. -- [[User:Peter|Peter]] 00:20, 17 Feb 2017 (UTC)
==Criticisms please==
|