Re: Sorting unicode strings
Re: Sorting unicode strings
- Subject: Re: Sorting unicode strings
- From: Ricky Sharp <email@hidden>
- Date: Thu, 30 Dec 2004 06:07:19 -0600
On Thursday, December 30, 2004, at 04:33AM, Ken Ferry <email@hidden> wrote:
>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.
Good catch! As it turns out, I'll be sticking with NSString's compare: per Ali's advice.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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