Re: case-insensitive but case-ordered sort
Re: case-insensitive but case-ordered sort
- Subject: Re: case-insensitive but case-ordered sort
- From: Keary Suska <email@hidden>
- Date: Tue, 20 Jul 2010 14:48:12 -0600
On Jul 20, 2010, at 11: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.
This approach will not provide overall lower-before-capital sorting, so I expect it won't work. Consider the following:
aClass
AAClass
Will sort, using the method you describe, to
AAClass
aClass
Because A comes before C and they are unequal (so a is never compared to A). Using a custom selector/function is probably the only way to go, and I can't think of any built-in method that will give the collation results you are looking for. I don't think you can escape a character-by-character comparison.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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