Earlier quoted context omitted.
> But assuming your original list is a list of versions (which seems reasonable given the presence of multiple decimal points for some cases), then that’s the order you’d want. What level of assumption is here expected from the sorting-system, would it have to process ALL entries of the list to find multiple decimal-points and then assume that they are ALL versions and not numbers? How to treat this on different loca…
It has nothing to do with decimal points. It just looks at any contiguous sequence of digits and treats it as a single character for the purposes of sorting. The decimal point could be any other character and the behavior would be the same.
When I say “alphabetical order”, I mean “alphabetical order”
351–360 of 385 posts
Re: When I say “alphabetical order”, I mean “alphabetical order”
#352Earlier quoted context omitted.
Ah yes sorry, 1.10 comes after 1.2 because 10 is bigger than 2 (so in fact different from your example). But assuming your original list is a list of versions (which seems reasonable given the presence of multiple decimal points for some cases), then that’s the order you’d want. If you have non-integer numbers in your filenames then it won’t give the order you want, but there isn’t going to be a rule that works for a…
There is a rule that works for all cases. It's lexicographical sorting. Simple. Consistent. Easy to manipulate to get what you want.
Re: When I say “alphabetical order”, I mean “alphabetical order”
#353Earlier quoted context omitted.
As I said, the sorting rule won’t always give pleasing results, but it seems to me like a simple and reasonable modification of lexicographic ordering.
It is neither simple, nor reasonable. 1.10, the number, is equivalent to 1.1. It is less than 1.2. You say you want numbers to sort as numbers, but you want 1.10 to be greater than 1.2. Do you consider '1/4' to be a number? Should it come before or after '1/3'? I'm guessing that you don't want to sort one character at a time if you encounter one of [0-9]. Instead, you want to group all consecutive [0-9] as a single s…
Treating consecutive digits as numbers is a simple modification (I still think it’s quite simple) that is easy to understand and supports 99% of real-world use cases.
Re: When I say “alphabetical order”, I mean “alphabetical order”
#354Earlier quoted context omitted.
I will add that I'm plenty "smart" enough to understand that "10" comes before "9" in a strictly alphabetical sense, and I still want my file managers to sort "9" before "10". I don't want to put leading zeroes before every all the single digit numbers in my file names. (And then potentially go come back later and add even more leading zeroes once the maximum number reaches three digits.) --- I split all of my audiob…
> I will add that I'm plenty "smart" enough to understand that "10" comes before "9" in a strictly alphabetical sense, and I still want my file managers to sort "9" before "10". Amen. > I split all of my audiobooks into chapters. I use the format "Chapter 01.mp3" (or "Chapter 001.mp3" when there are > 99 chapters) because some (all?) MP3 players are too stupid to sort numbers properly and I want my audiobooks to work…
- A lot of my audiobooks come as mp3, and converting to m4b (which is AAC based) would mean loosing quality.
- Some MP3 players (even those that support AAC) don’t support M4B.
- I want playback to stop automatically at the end of a chapter, unless I actively decide to start the next chapter. (Admittedly, some MP3 players don’t have an option for this anyway and will always start the next track. This annoys me.)
- Even with chapter metadata, I find it difficult to seek through a 10+ hour m4b file. Seeking through a 10 – 60 minute chapter is more manageable. (Of course, this doesn’t always work out; A Memory of Light has a single chapter that’s more than ten hours long. Whatever, I want to split in a way that follows the author’s structure, and Sanderson purposefully chose to write one extremely long chapter.)
I probably sound like I regularly switch between 20+ different models of MP3 player. In fact, I mostly use my computer or iPhone these days; however, I expect my audiobook collection to outlast any one piece of hardware.
Re: When I say “alphabetical order”, I mean “alphabetical order”
#355Re: When I say “alphabetical order”, I mean “alphabetical order”
#356FWIW, for Windows Explorer the numerical sort order can be disabled by setting the DWORD value HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Currentversion\Policies\Explorer\NoStrCmpLogical in the registry to 1.
Re: When I say “alphabetical order”, I mean “alphabetical order”
#357Earlier quoted context omitted.
I think the only problem is that it's a surprise and mystery, particularly because "dumb" alphabetical sort has existed forever. When they "fixed this" for the 99% of regular users cases, they should have made it as separate "smart natural sort" option separate from the "strict alphabetical sort" option (next to date, size, etc). Simple and obvious, rather than surprisingly different from the decades of experience th…
It's not just the one decision though; there are literally thousands, maybe tens of thousands, of these decisions in most software. You want every single one of them to have an option? You want it to support every single combination? At some point, it is ridiculous. Sometimes you just have to decide how your software is going to work and not leave every single decision to the user.
(I say this as a professional developer and power-user of all 3 desktops over the past 25 ish years, who also helps non-technical family and friends a few times every year. Some people will be like "oh I'm so bad at computers lol" or "oh this is a piece of junk huh" but really the UI just got dumber in the name of "ease of use", and the expert has to be called in to decipher it.)
Re: When I say “alphabetical order”, I mean “alphabetical order”
#358FWIW, for Windows Explorer the numerical sort order can be disabled by setting the DWORD value HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Currentversion\Policies\Explorer\NoStrCmpLogical in the registry to 1.
I honestly thought Explorer was broken and have been looking into 3rd party file browsers for Windows because this has been driving me so nuts. Thank you!
Re: When I say “alphabetical order”, I mean “alphabetical order”
#359Earlier quoted context omitted.
> Treat any consecutive sequence of digits as a number when sorting. Based on this description, I have no idea how the following would be sorted: • photo.jpg • photo1.jpg • photo01.jpg • photos.jpg
Does it matter? There's a user expectation that photo20.jpg comes after photo3.jpg. There's no user expectation around whether photo1.jpg or photo01.jpg comes first. Just like there's no user expectation around whether photo1.jpg or Photo1.jpg comes first. Users also don't have the slightest idea about what order punctuation gets sorted in. Just sort the things that matter in the way users expect (natural sort order)…
Yes. An algorithm must be unambiguosly specified for all possible inputs.
Re: When I say “alphabetical order”, I mean “alphabetical order”
#360I thought this was pretty well known. E.g. the macOS Foundation library even exposes NSString.localizedStandardCompare() [1] which implements the sorting algorithm used by Finder, and should be used by any well-behaved macOS application. Windows uses StrCompareLogical [2]. [1] https://developer.apple.com/documentation/foundation/nsstrin... :) [2] https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/...
The Finder sorts these as:
IMG_20250820_095716_607.jpg
IMG_20250820_103857_991.jpg
IMG_20250820_103903_811.jpg
IMG_20250820_055436307.jpg
IMG_20250820_092016029_HDR.jpg
IMG_20250820_092440966_HDR.jpg
IMG_20250820_092832138_HDR.jpg
Whereas `ls -l` gives me IMG_20250820_055436307.jpg
IMG_20250820_092016029_HDR.jpg
IMG_20250820_092440966_HDR.jpg
IMG_20250820_092832138_HDR.jpg
IMG_20250820_095716_607.jpg
IMG_20250820_103857_991.jpg
IMG_20250820_103903_811.jpg