• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sorting unicode strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Shark: Attempt to insert nil key?
      • From: "Douglas A. Welton" <email@hidden>
References: 
 >Sorting unicode strings (From: Ricky Sharp <email@hidden>)
 >Re: Sorting unicode strings (From: Ken Ferry <email@hidden>)

  • Prev by Date: Re: Sorting unicode strings
  • Next by Date: Re: Sorting unicode strings
  • Previous by thread: Re: Sorting unicode strings
  • Next by thread: Shark: Attempt to insert nil key?
  • Index(es):
    • Date
    • Thread