Sorting Array alphabetically

11,255

Solution 1

[myArray sortUsingSelector:@selector(caseInsensitiveCompare:)];

Solution 2

NSArray *sortedStrings = [strings sortedArrayUsingSelector:@selector(compare:)];

Solution 3

If the array consists of NSStrings:

[companies sortUsingSelector:@selector(compare:)];
Share:
11,255
Gypsa
Author by

Gypsa

iphone,ipad,mac developer

Updated on June 04, 2022

Comments

  • Gypsa
    Gypsa almost 2 years

    Possible Duplicate:
    How to sort a NSArray alphabetically?

    Hi all, I have an array which consist of companies name. I want to sort array alphabetically so that companies name come in alphabetic order. Please suggest me how to do this. Thanks in advance