I would like to know if there is a command in which you can arrange
this array in alphabetical order, so that the end result of the array
becomes…
Yes. If you look at the NSMutableArray
documentation you’ll find a list of methods that can be used for sorting. They all start with the word “sort”.
Apple also provides documentation on sorting arrays in the section named Sorting Arrays in Collection Programming Topics. For example, you could use the method -sortUsingSelector:
this way:
NSMutableArray *names = [@[@"how", @"anderson", @"format", @"babilon"] mutableCopy];
[names sortUsingSelector:@selector(compare:)];
2
solved Sort an NSMutableArray alphabetically [duplicate]