1

Can anyone please suggest how to sort array containing objects such as:

    "abd",
    "kkkkkkkkkkkkkkkkkk",
    "Take 1",
    "Take 10",
    "Take 11",
    "Take 12",
    "Take 13",
    "Take 14",
    "Take 15",
    "Take 16",
    "Take 17",
    "Take 18",
    "Take 2",
    "Take 4",
    "Take 5",
    "Take 6",
    "Take 8"

Sort the array in ascending order so that "Take 2" comes after "Take 1".

Pablo Claus
  • 5,886
  • 3
  • 29
  • 38

1 Answers1

1

You could use the sort selector on an array:

NSArray *sortedArray = [yourArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
tiguero
  • 11,477
  • 5
  • 43
  • 61
  • actually this is not enough you need some extra logic to take in account the number - so you will need to write your own comparison method instead – tiguero Aug 29 '12 at 13:28