Re: Natural sort comparison
- Posted by _tom (admin) Jul 21, 2017
- 2071 views
petelomax said...
_tom said...
The Natural Order algorithm is by Andy Serpa. The existing algo does not do everything:
The algorithm only takes into account "unbroken" integers within the character strings it makes no allowance for decimal points (although it will still work correctly as long as there are an equal number of digits to the right of the decimal point in each number being compared).
I have not thought about unicode and case sensitivity (monocasting; seems like an ugly word) variations in a custom sort.
You're gonna hate me: http://rosettacode.org/wiki/Natural_sorting#Phix
It might need enhancing for the 1.009 vs 1.1 case, with some prev='.' tests or similar
Pete
You use a syntax trick in Phix; no cut and paste for OE.
A ligature is "two characters combined into one."
hence o and e becomes œ
_tom