Sorting Array alphabetically [duplicate]

限于喜欢 提交于 2019-12-06 03:50:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!