Re: C# code to sort by alphanumeric

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Mon, 24 Aug 2009 06:50:42 -0700, Jeff Johnson <i.get@xxxxxxxxxxx> wrote:

"Jeff Johnson" <i.get@xxxxxxxxxxx> wrote in message
news:eIYYcCMJKHA.356@xxxxxxxxxxxxxxxxxxxxxxx

An intimate knowledge of the ASCII chart is something I believe every
programmer should have. It would make the reason for the sort order you
see below obvious.

CLEAR
CLEAR_1553_BUFFER
CLEAR_708_BUFFER
CLEAR_ALL
CLEAR_SET_NUM
CLEARSEM

Wait, I just noticed the last item in the list, and I withdraw the "obvious"
comment (although it still applies to the first 5 items). The underscore
comes after captial letters, so I don't know why CLEARSEM would sort to the
end. There must be something else going on here. Anyone have an idea?

Yes. The default sort order weights different characters differently. Things like hyphens and underscores tend to be ignored for the purpose of sorting.

One can cause those characters to be full participants in the sort by specifying a different sort method (e.g. ordinal).

We just had a thread a week or two ago, wherein a fellow was quite irate that .NET didn't always sort the way _he_ wanted by default. If you want more details, you might be able to find something useful there (though, maybe not since the irate fellow didn't seem to).

Pete
.



Relevant Pages

  • Re: Reverse order file dialog box
    ... Wesley Vogel wrote: ... mainly sort order. ... Ctrl + Close saves folder settings. ...
    (microsoft.public.windowsxp.basics)
  • Re: Reverse order file dialog box
    ... UserPreferencesMask is another one that uses multiple bits for many settings. ... mainly sort order. ... Ctrl + Close saves folder settings. ...
    (microsoft.public.windowsxp.basics)
  • Re: Reverse order file dialog box
    ... ShellState gets messed up is what causes it. ... mainly sort order. ... Ctrl + Close saves folder settings. ...
    (microsoft.public.windowsxp.basics)
  • Re: Reverse order file dialog box
    ... mainly sort order. ... Ctrl + Close saves folder settings. ... files first, in reverse alphabetical order, followed by the ...
    (microsoft.public.windowsxp.basics)
  • Re: BROWSE: order by column
    ... oHdr is now a reference to the header object ... descending sort. ... If you have a lot of columns that would be a lot of command ... Just add the code to change the sort order to a new ...
    (microsoft.public.fox.programmer.exchange)