Sorting an nsarray of strings not string based
问题 So i have an array that i retrieve from a web service in no particular order example: 0 => x large, 1 => large, 2 => XX large, 3 => small, 4 => medium, 5 => x small I need to sort them: firstly based on specific - which could be reverse alphabetic: small medium large Secondly i need to sort them based on their 'x' counter parts: x small small medium large x large xx large I know i can do this with brute force string matching but i would really like a suggestion on how to do this tidily,