4 ms·
It feels like this algorithm could be improved though. If a number has leading zeros you probably don't want to sort it numerically. That said the author's sit
by IshKebab 1y ago
It feels like this algorithm could be improved though. If a number has leading zeros you probably don't want to sort it numerically.
That said the author's situation where it's numerical and different lengths seems likely rare enough that it probably isn't worth complicating things.
- debazel 1y agoThe leading zero isn't an issue because it will sort correctly under both systems. The issue OP is having is that he's adding random numbers after the hhmmss section. If instead he added a delimiter before the random number the files would sort correctly under both systems as well, e.g. hhmmss_num.
- IshKebab 1y agoYes that's what I said: > where it's numerical and different lengths
- kiitos 1y agofor me the takeaway here isn't that sorting should use some smarter/better mechanism for inferring semantic intent from filenames, but rather that sorting should not try to infer semantic intent from filenames in the first place