Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sorting Array alphabetically [duplicate]

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

like image 645
Gypsa Avatar asked May 24 '11 08:05

Gypsa


2 Answers

[myArray sortUsingSelector:@selector(caseInsensitiveCompare:)];
like image 175
omz Avatar answered Oct 04 '22 01:10

omz


NSArray *sortedStrings = [strings sortedArrayUsingSelector:@selector(compare:)];
like image 33
Rams Avatar answered Oct 04 '22 01:10

Rams