Oddity: Leading hyphen in filename ignored for sorts?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Oddity: Leading hyphen in filename ignored for sorts?

Post by j_c_hallgren »

Noticed something unusual tonight: Renamed some files with a leading dash/hyphen expecting them to be sorted near top of list when in seq by filename but they are in order based on 2nd-nth chars. :?

Checked WE on this W2K sys and it does the same...a leading + or underscore acts like one would expect but not the - which I don't quite understand why.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

admin
Site Admin
Posts: 66365
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Oddity: Leading hyphen in filename ignored for sorts?

Post by admin »

Wow, I never noted this! Quite shocking...

Check this (search for "hyphen"):
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
The functions CompareString, CompareStringEx, lstrcmp, lstrcmpi, LCMapString, LCMapStringEx, FindNLSString, and FindNLSStringEx all default to use of a "word sort" technique. For this type of sort, all punctuation marks and other nonalphanumeric characters, except for the hyphen and the apostrophe, come before any alphanumeric character. The hyphen and the apostrophe are treated differently from the other nonalphanumeric characters to ensure that words such as "coop" and "co-op" stay together in a sorted list.

Post Reply