Re: Sorting Array Alphabetically
Re: Sorting Array Alphabetically
- Subject: Re: Sorting Array Alphabetically
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sun, 15 Apr 2007 13:56:05 +0700
On 14 Apr 2007, at 10:00, email@hidden wrote:
Date: Fri, 13 Apr 2007 13:17:58 -0700
From: Deborah Goldsmith <email@hidden>
Subject: Re: Sorting Array Alphabetically
To: Shamyl Zakariya <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
I think the first one will work the way you want by passing
NSString's compare:
Not quite. Based on the sample data, I'm guessing this sort is
intended to be shown to an end user. compare: should *never* be used
to sort a list for display to an end user. It does a comparison based
on the Unicode code point values, which is not what most users would
consider "sorted."
Lists being sorted for end users should *always* use
localizedCompare: or localizedCaseInsensitiveCompare:. Only use
compare: if the end user will not see the ordering.
I just looked up this method in AppKiDo and only found: "... using a
localized comparison.".
Could you give an example where this differs from a simple compare: ?
And what localized values are used? Where are these set?
compare:options:range:locale: uses a locale-dictionary, but again
does not specifies which key/value pairs are expected or allowed in
this dictionary.
Gerriet.
P.S. Just found an example, where compare: and localizedCompare: differ:
Sort "red" and "horse" in Thai (I do not write the Thai words,
because I know that the digest software cannot handle Unicode (which,
by the way, is really a shame) ).
But: how can the sort-order be localized? Is there any place in this
world, where Thai words are sorted differently?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden