Weird sorting with underscores versus dashes
Closed this issue · 2 comments
rlwhitcomb commented
Consider these two arrays:
a1 = [ "a_1", "a1_1", "a2_1" ]
a2 = [ "a-1", "a1-1", "a2-1" ]
Which when sorted using this "natural order" code gives these results:
sort a1 => [ "a1_1", "a2_1", "a_1" ]
sort a2 => [ "a-1", "a1-1", "a2-1" ]
I would have expected the order we see for a2
on both, which is what I've seen in other places doing "natural order" sorting (as in, "sort each subgroup that are separated by punctuation").
What do you think? I don't have code changes to handle this (yet), though.
616slayer616 commented
Hi @rlwhitcomb
sorry I had not seen the issue.
I will look into it.
But I don't know if I can fix it
rlwhitcomb commented
Just pulled the code. Works like a champ. Thanks, @616slayer616!