You should be able to accomplish what you want using NSPredicate.

You can also use the C functions topper and tolower to detect and distinguish 
case differences.

On Jul 20, 2010, at 1:39 PM, Roland King wrote:

> I want to sort some NSStrings in such a way that words group case 
> insensitively, but within that group lowercase comes first, effectively I 
> want the sort order of letters to be
> 
> aAbBcCdDeEfF  .. etc with everything outside the letter space sorting 
> 'naturally' and coming after the letters (I actually don't care too much 
> about the last bit honestly they can go where they like as long as it's 
> outside the alphabet range). 
> 
> so 
> 
> myClass               comes before
> MyClass               which comes before
> yourClass             which comes before
> YourClass 
> 
> First off is there a defined sort routine in or around NSString which does 
> something like this (I found a kCFCompareForcedOrdering flag in CFString 
> which seems to do something similar, but possibly backwards from what I 
> want). I can restrict the domain to ASCII without any real issues but if 
> there's something which is localized, that would be better. 
> 
> 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. 
> 
> Is there an NSString or CFString method I should be looking at or am I off to 
> roll my own? _______________________________________________
> 
> 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/3tothe4th%40comcast.net
> 
> This email sent to 3tothe...@comcast.net

Charlie Dickman
3tothe...@comcast.net



_______________________________________________

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