The problem is that by default sort uses strict numeric comparisons. To those comparisons, 15 and 15–21 look the same. You should write your
own comparison function, one that will check for the ndash, and do the right thing.
Of course, you'll need to decide what to do when you get two ndash strings with identical lower bounds and different upperbounds - or decide that can not happen, and then document that in the comments.
Comment on Re: Problem sorting strings numerically