Tuesday, December 12, 2006 12:01 AM
Michael S. Kaplan
Sorting numbers as text AND as digits
It's funny, but the past few years whenever I have had to fly I have noticed (whether sitting in my scooter or sitting in a wheelchair) that people in the airport are really not paying very much attention where they are going. I m not sure what it is, but people kind of turn off the part of their brains that pays attention to details.
People are the same way when they use their computers, I think. So most people may not have noticed the kind of thing this post is about....
As much as the Shell tries to do everything that it does in a consistent way, the little things get in the way.
Like let's take sorting numbers as digits rather than as text, as discussed in What is up with number sorting? and other posts.
So I am in Vista with some text files designed to arbitrarily and unrealistically show off the feature:

Now we already know that the Command Prompt won't handle things the same way:

But if you look at some other pieces that the Shell provides like the File Open dialog (seen here in Notepad) you can see it looks like StrCmpLogicalW is being used again:

But if you try to start typing in file in the File name text box and then wait for a second, you see the sorted list of files:

Looks like your average everyday listbox with the LBS_SORT style on it, so that when LB_ADDSTRING is called something like a bunch of calls to lstrcmpW or lstrcmpiW happen to support some kind of insertion sort. So you have a list of files in the listbox that is not in the same order as the list in the listview above.it.
It is of course also possible that no one noticed this kind of thing (like most minor inconsistencies like this, I found it by accident).
I think most people do not spend much time paying attention to the Shell, even if they constantly use it. It's like they are at the airport or something, bumping into my scooter. :-)
This post brought to you by ໖ (U+0ed6, a.k.a. LAO DIGIT SIX)