• 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 Array Alphabetically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Sorting Array Alphabetically
      • From: Johan Kool <email@hidden>
  • Prev by Date: CGEventKeyboardGetUnicodeString + modifier key
  • Next by Date: Re: CGEventKeyboardGetUnicodeString + modifier key
  • Previous by thread: Re: Sorting Array Alphabetically
  • Next by thread: Re: Sorting Array Alphabetically
  • Index(es):
    • Date
    • Thread