Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare
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