Re: Sorting Array Alphabetically
Re: Sorting Array Alphabetically
- Subject: Re: Sorting Array Alphabetically
- From: Jeff C <email@hidden>
- Date: Fri, 13 Apr 2007 21:09:40 -0400
It would be nice if the documentation for [NSString compare] and its
other forms stated this.
localizedCompare isn't even in the see also list for [NSString
compare:options:range:locale:].
On Apr 13, 2007, at 4:17 PM, Deborah Goldsmith wrote:
I think the first one will work the way you want by passing
NSString's compare:
Not quite. Based on the sample data, I'm guessing this sort is
intended to be shown to an end user. compare: should *never* be
used to sort a list for display to an end user. It does a
comparison based on the Unicode code point values, which is not
what most users would consider "sorted."
Lists being sorted for end users should *always* use
localizedCompare: or localizedCaseInsensitiveCompare:. Only use
compare: if the end user will not see the ordering.
Deborah Goldsmith
Internationalization, Unicode liaison
Apple Inc.
email@hidden
On Apr 13, 2007, at 6:57 AM, Shamyl Zakariya wrote:
Look at NSMutableArray
- (void) sortUsingSelector:
- (void) sortUsingFunction:(int (*)(id, id, void *))compare
context:(void *)context
- (void) sortUsingDescriptors:(NSArray *)sortDescriptors
I think the first one will work the way you want by passing
NSString's compare:
Shamyl Zakariya
"there is no emoticon, for what I am feeling"
On Apr 13, 2007, at 8:53 AM, Micha Fuhrmann wrote:
Hi there!
I've looked around and couldn't find anything.
I've got a NSMutableArray with Strings in it. Po the Array in gdb
gives the list of it with the strings and not objects such as:
<NSCFArray 0x3a3e80>(
Nightmares On Wax,
John Martyn,
The Kinks,....
Now, I'd like to sort this Array Alphabetically, how do I go about?
Any help would be appreciated. Also, if I've missed something,
like NSMutableArray shouldn't be filled with plain strings but
objects in manner to give me more control please let me know.
Micha
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40zakariya.net
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40earthlink.net
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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