New in Windows Vista: OrdinalIgnoreCase for Win32

by Michael S. Kaplan, published on 2005/12/22 10:01 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/12/22/506595.aspx


I have talked many times in the past about Ordinal and OrdinalIgnoreCase sorting behavior and when you might want to use it (such as here and here and especially here, for example).

I went to great lengths to point how the reason that the managed 'OrdinalIgnoreCase' functionality was important to help mimic the OS behavior with regard to symbolic identifiers.

Of course there was one problem: no Win32 function exists that allows support for this type of comparison. So the actual platform that needed the behavior required some extra work to actually happen.

Now it isn't much work, but still...

Anyway, that all changes in Vista, with the new CompareStringOrdinal function we have added to the NLS API.

The documentation notes all of the various linguistic types of comparisons that the function does NOT handle, so that people can work to get the behavior they want, depending on what they are trying to do.

So now that we can get the answer for Windows and the .NET Framework, all we need is a faster way to make the SQL Server binary collations have this admittedly un-natural comaprison behavior as well!

 

This post brought to you by "Ʃ" (U+01a9, a.k.a. LATIN CAPITAL LETTER ESH)


# Mihai on 22 Dec 2005 12:59 PM:

Correction for the CompareStringOrdinal documentation (following the link in your post):
"it will it will test all code points"

# Michael S. Kaplan on 22 Dec 2005 1:12 PM:

Yes, hypothetically that should be 'code units' though the fact that almost no one outside the world of Unicode geekdom would understand what that is (and the number of people who would understand it correctly outnumber the group who would not!).

# Michael S. Kaplan on 22 Dec 2005 1:45 PM:

In case people were wondering, this function is indeed a wrapper around the RtlCompareUnicodeString function I have mentioned before. :-)

# kevinowen on 22 Dec 2005 2:05 PM:

I think Mihai was referring to the fact that "it will" appears twice...

# Michael S. Kaplan on 22 Dec 2005 2:19 PM:

Yikes, I missed that one entirely (the one I mentioned had been a discussion point, so I immediately assumed that was it)!

Ah well, good report, thanks to both of you. :-)

referenced by

2007/10/12 That function is always faster! (well, except for that one case when it can actually be slower...)

2006/05/24 Invariant vs. Ordinal, the third

2006/05/12 Don't use lstrcmp if you don't need it

2006/03/02 CompareString ignores case by lowercasing....

go to newer or older post, or back to index or month or day