问题
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
回答1:
[myArray sortUsingSelector:@selector(caseInsensitiveCompare:)];
回答2:
NSArray *sortedStrings = [strings sortedArrayUsingSelector:@selector(compare:)];
回答3:
See this.... Alphabetical Sort
回答4:
If the array consists of NSStrings
:
[companies sortUsingSelector:@selector(compare:)];
来源:https://stackoverflow.com/questions/6107725/sorting-array-alphabetically