View Single Post
Old 05-24-2022, 10:45 AM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,891
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by ReaderGuy42 View Post
I have numbered a series of books, as they're in a long series (The Legend of Drizzt with upwards of 40 books), so I can tell which order they go in.

However, now when I sort them by title, they appear numbered like shown in the title, e.g.
1, 10, 11, 12 . . . 2, 20, 21, 22, and so on.

I'm not sure if this is a Linux issue because I was recently having similar issues in my Linux Mint file explorer. Or is there a way to have the numbers be sorted correctly?

Thanks
Keyword: Alphasort

The sort is by CHARACTER weight (position in the ASCII table),
not the numeric value of digits included in the string.

The common way to make strings sort is to pad the leading places (as needed to make the highest number sort).
eg.
highest number
500 then pad 00 for single digit, 000 if 0
20 then a single 0 pad

You could use a space (ASCII%20), but those are really hard to see if you counted right, on most screens.
FWIW I commonly steer folder sorts by using a leading number:0First (or force to the end:zMakethislast) lowercase sorts AFTER uppercase
theducks is offline   Reply With Quote