On Aug 1, 2012, at 12:08 PM, Alex Zavatone <[email protected]> wrote:
>> If your comparison is only going to be a single method call with a single
>> parameter like this, then probably a bit simpler to use:
>>
>> [sortkeys sortUsingSelector:@selector(compare:)];
>
> What's the reason for not using caseInsensitivecompare?
I'm guessing just an oversight.
Also, you can save a line of code with
NSArray *sortedkeys = [[countries allKeys]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
If you need to do anything more than simple alphabetical sort it gets more
verbose, but for sorting country names this should suffice.
I suspect this is one of those things for which lots of people have their own
category methods on NSArray and/or NSString.
--Andy
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]