Re: Sorting unicode strings
Re: Sorting unicode strings
- Subject: Re: Sorting unicode strings
- From: Ali Ozer <email@hidden>
- Date: Wed, 29 Dec 2004 21:01:22 -0800
Using the localized option should theoretically be enough. I think
right now it's not compatible with Finder's in some small ways, but
we're looking to fix them for Tiger. I would not recommend using
UCCompareTextDefault(), as anything which requires extracting contents
of NS/CFStrings just leads to unnecessary inefficiency.
Ali
Begin forwarded message:
From: Ricky Sharp <email@hidden>
Date: December 29, 2004 12:58:07 PST
To: email@hidden
Subject: Sorting unicode strings
My upcoming product, while not initialially localized, will allow
users to enter in unicode for names of students. One such area of my
UI displays a list of these names and I'd like the them to be
reasonably sorted.
To see what Finder did, I created several folders with various text
(English, Japanese, Chinese, etc.).
I then created a simple app that built instances of NSString with the
folder names and sorted them with NSString's compare:options: I used
NSLiteralSearch for the options param. The results almost gave me the
same as what Finder did.
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?
I'm also thinking of writing an enhancement request to add in a new
option flag say named NSFinderSearch. That option of course would
mimic what Finder does and may be of some help to app developers.
Thoughts?
--
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
_______________________________________________
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