Page 1 of 1

TC4A 3.0b13: Numbers are sorted in alphabetic order

Posted: 2019-12-27, 22:56 UTC
by Usher
When using sort by name, files with numbered names are ordered in alphabetic order rather than numerical. For example 1, 2, 3, 10, 11, 12, 100, 101, 1000 are ordered as 1, 10, 100, 1000, 101, 11, 12, 2, 3. It's annoying for longer file lists.
Tested on Android 8. Is the sort order system dependent or possible to improve?

Re: TC4A 3.0b13: Numbers are sorted in alphabetic order

Posted: 2019-12-28, 02:11 UTC
by rudolfm
This is normal with computers in general. All file managers do this.
Name your files 0001,0002,0010,0020 if you want then sorted.
With dates, use 2019-12-30 and not 30-12-2019.

Look at the download server of mozilla Firefox for Android, you will see the same thing:
https://ftp.mozilla.org/pub/mobile/releases/

Re: TC4A 3.0b13: Numbers are sorted in alphabetic order

Posted: 2019-12-28, 06:24 UTC
by Usher
rudolfm wrote: 2019-12-28, 02:11 UTC This is normal with computers in general. All file managers do this.
Any good file manager can provide more refined sort order than simple command line tools. Even Windows Explorer can. Do you use Total Commander for Windows?
rudolfm wrote: 2019-12-28, 02:11 UTCLook at the download server of mozilla Firefox for Android, you will see the same thing: https://ftp.mozilla.org/pub/mobile/releases/
It's a table generated by a web server using some server-side (command line) tools. Real FTP site looks like that: ftp://ftp.icm.edu.pl/pub/mozilla/firefox/releases/ and it also provides results generated by the server-side tools.

If you go to ftp://ftp.icm.edu.pl/pub/ you will see typical Unix-like sort order (UPPERCASE before lowercase) - it's system dependent sort order. Firefox does NOT re-sort names to use letter-case independent sort.

Re: TC4A 3.0b13: Numbers are sorted in alphabetic order

Posted: 2019-12-29, 08:42 UTC
by ghisler(Author)
Sadly there is no sort function in Java to sort with this so called "natural sorting" method. I could do my own sort function, but it would be many orders of magnitude slower because java byte code is much slower than hard coded machine code used now.

Re: TC4A 3.0b13: Numbers are sorted in alphabetic order

Posted: 2019-12-29, 14:41 UTC
by Usher
2ghisler(Author)
Thanks for explanations. Some apk developers seems to ignore that fact - they use numbers without leading zeros for filenames and provide misordered lists in their apps.