Re: C# code to sort by alphanumeric
- From: "Peter Duniho" <no.peted.spam@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 24 Aug 2009 10:10:51 -0700
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
.
- Follow-Ups:
- Re: C# code to sort by alphanumeric
- From: Jeff Johnson
- Re: C# code to sort by alphanumeric
- References:
- C# code to sort by alphanumeric
- From: Jason
- Re: C# code to sort by alphanumeric
- From: Jeff Johnson
- Re: C# code to sort by alphanumeric
- From: Jeff Johnson
- C# code to sort by alphanumeric
- Prev by Date: Re: Implement a Case INsensitive string.Comtains method?
- Next by Date: Re: TableLayoutPanel problem
- Previous by thread: Re: C# code to sort by alphanumeric
- Next by thread: Re: C# code to sort by alphanumeric
- Index(es):
Relevant Pages
|