• 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: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare


  • Subject: Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
  • From: Kyle Sluder <email@hidden>
  • Date: Sat, 05 May 2012 16:51:39 -0700

On May 5, 2012, at 3:43 PM, Martin Wierschin <email@hidden> wrote:

>> If I'm right, then sort order and search order are different, and you can't expect to use a binary search here. (Not unless you originally used pair-wise 'localizedCaseInsensitiveCompare' to manually sort the list of strings.)
>
> All comparisons, including those used for the original sorting, were done using the same comparison method/locale. And the sort order and search order need to be same, otherwise any algorithms that rely on the transitive nature of comparisons (eg: quicksort, binary search, etc) will fail.

If I understand Quincey correctly, that's exactly what he's saying: the semantics of localizedCaseInsensitiveCompare: might be such that it is not appropriate for such algorithms.

i18n is tricky. It might be worth consulting the Unicode docs on collation.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
      • From: Martin Wierschin <email@hidden>
    • Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
      • From: Jens Alfke <email@hidden>
References: 
 >inconsistent behavior of NSString's localizedCaseInsensitiveCompare (From: Martin Wierschin <email@hidden>)
 >Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare (From: Quincey Morris <email@hidden>)
 >Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare (From: Martin Wierschin <email@hidden>)

  • Prev by Date: Re: Strange issue in stroking a bezier path
  • Next by Date: Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
  • Previous by thread: Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
  • Next by thread: Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
  • Index(es):
    • Date
    • Thread