On Jul 20, 2010, at 10:39 AM, Roland King wrote:
> I thought perhaps that comparing the two strings case insensitively, 
> returning that compare if they are not equal, but if they are equal, 
> comparing them case sensitively and returning the inverse of that (remember I 
> want a to beat A) would do what I want but I've failed to convince myself 
> that actually works.

I think that would work; it's the approach I'd use at least... QA1159 mentions 
the -localizedStandardCompare: method on NSString, and the 
UCCompareTextDefault() C function, but I think both of those sort the wrong way 
around for your purposes (capitals before lowercase).

My understanding is that kCFCompareForcedOrdering doesn't guarantee any 
*particular* ordering for items which would otherwise compare equal--- that is, 
there'll be a fixed ordering, but it might change in another release, or 
something; the specific way in which it breaks ties is not part of its 
specification.

(Another approach would be to sort case-sensitively, and backwards, followed by 
a *stable* case-insensitive forwards sort. But I think this would be both more 
difficult to implement and slower to run than the alternative.)


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to