Re: -[NSString localizedCompare:] - example of semantic difference with compare?
Re: -[NSString localizedCompare:] - example of semantic difference with compare?
- Subject: Re: -[NSString localizedCompare:] - example of semantic difference with compare?
- From: Ricky Sharp <email@hidden>
- Date: Mon, 27 Mar 2006 17:09:59 -0600
On Mar 27, 2006, at 4:09 PM, Aki Inoue wrote:
Ricky,
CFComparisonResult theCFResult =
CFStringCompareWithOptions ((CFStringRef) self,
(CFStringRef) anItemName, CFRangeMake (0,
CFStringGetLength ((CFStringRef) self)),
kCFCompareCaseInsensitive | kCFCompareLocalized |
kCFCompareNumerically);
I recommend also using kCFCompareNonliteral here. Without it,
CFString doesn't compare attached and detached accents equally
which is essential to most localized sorting.
Thanks again for pointing out to do non-literal compares. This also
cleaned up a bug in my insert student routine where I prevent users
from adding someone with the same name.
Previously, If I had a name of O-macron (U+014C), I was also able to
add a name of O followed by a combining macron (U+004F, U+0304).
With the modified code, these now compare identically.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden