Talk:Natural sorting: Difference between revisions

 
(3 intermediate revisions by the same user not shown)
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 ['''erm, leftmost''' [[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 19:03, 7 April 2017 (UTC)] fields are equal then compare the next two fields, and so on.
# 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 71:
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)
 
HelloTask Peter,point afour differentis Peter hereself-contradictory. TheIt neatsays completeness"with ofthe 1..4rightmost mayfields bebeing beguiling,the butmost forsignificant" instanceand addlater foo3baz99bar9.txton to"x9y99 thatbefore lastx9y100, list. I cannot think of a single example where sorting words left to right but numbers right to left would make it easier for a human to find anything. Surely thebefore x10y0"rightmost", in 3 abovewhich is just a simple typo and should always have saidthe leftmost -fields inbeing factthe Imost have decided to plant an edit right on itsignificant. [[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 19:0318, 7 April 2017 (UTC)
 
==Criticisms please==
7,813

edits