I have an array of strings (names)
and i would like to sort them like how the address book on the iphone sorts them
- eg: éli -> under E
- eg: àli -> under A
- eg: 4li -> under #
any suggestions?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to perform a diacritic insensitive comparison against the strings.
NSStringhas acompare:options:method with an option ofNSDiacriticInsensitiveSearch.Edit:
Here is a full example that will section the results based on the first character diacritic insensitive. I put in a dictionary so you would need to keep track of the sorted keys on your own to display properly.