• The forum software that supports hummy.tv has been upgraded to XenForo 2.3!

    Please bear with us as we continue to tweak things, and feel free to post any questions, issues or suggestions in the upgrade thread.

file name & sort Q

Sargan

Member
I have several folders which contain a number of films .... that I would like to show in order they were produced.
i.e I have a set of James Bond films.
To allow easy sort I put the numerical sequence number in front of file name .... thinking it would then sort in order 1 - 26
However, it does not sort in order even if I have 'sort [by name] current' in the GUI


Is there a simple way to fix this ?

You can see they are not 'in order' assume it is ignoring the numeric character, but they are not sorted alphabetically if you ignore the numeric.

Bond.jpg
 
They are sorted lexicographically, and the sorting is correct.
You can either number them "01" or " 1" to get your desired order. I've used the latter in the past e.g. thing 1 comes before thing 10, in the middle of items.
Obviously a leading space is a problem for filenames, so that only leaves you with the other option.
 
This is unbelievably old hat!

They are sorted lexicographically
Lexicographically? Lexicons only deal with alphabetic characters. We could say the sorting is alphanumeric, but that does not account for special characters. I assume a lower case / upper case conversion is performed first.

@Sargan : Modern desktop operating systems have clever sorting abilities, able to recognise numeric fields within longer strings and assuming leading zeros as necessary, but this is a "simple" sort – compare the first character in the string, then the second character, etc. Writing the prefix numbers as 01, 02, 03... solves your problem.
 
Lexicographically? Lexicons only deal with alphabetic characters. We could say the sorting is alphanumeric, but that does not account for special characters.
I struggled to find a more correct word (I did check), and still do. As it seems do you.
I cribbed the following from here: https://nitishhsinghhh.medium.com/u...phic-order-in-programming-with-c-6d283dce5233
"
In mathematics, the lexicographic order extends the concept of alphabetical order to sequences of ordered symbols or elements of a totally ordered set.

Lexicographic order is an ordering of elements based on their alphabetical or numerical order. It is similar to the way words are organized in a dictionary. In lexicographic order, the comparison of elements is done character by character or digit by digit, starting from the leftmost position.

In programming, lexicographic order is determined based on the ASCII or Unicode values of the characters. The order of characters in the ASCII table is well-defined, with lowercase letters having higher values than uppercase letters, and digits being ordered sequentially.
"
I assume a lower case / upper case conversion is performed first.
The comparison is case-insensitive, yes.
 
Last edited:
Back
Top