Re: Sorting unicode strings
Re: Sorting unicode strings
- Subject: Re: Sorting unicode strings
- From: Ken Ferry <email@hidden>
- Date: Thu, 30 Dec 2004 05:33:54 -0500
On Wed, 29 Dec 2004 14:58:07 -0600, Ricky Sharp <email@hidden> wrote:
> In searching Google, I ran into a posting on this list (May 2002) that mentioned the use of UCCompareTextDefault with various options flags. The goal was to mimic what Finder does.
>
> While I can certainly use that code, I wanted to first find out how others are dealing with sorting their strings. Do you keep things "simple" and just use NSString's compare:, or do you take a more elaborate approach and attempt to mimic the Finder?
If you're referring to the message at
<http://www.cocoabuilder.com/archive/message/2002/5/22/62842> then be
a little careful: There's a bug in it. UCCompareTextDefault does not
expect the string data to begin with a BOM, but there will be if the
data is obtained by calling [string
dataUsingEncoding:NSUnicodeStringEncoding]. Try comparing any two
strings of length one with that code. You'll get NSOrderedSame.
-Ken
_______________________________________________
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