字符串数组排序
NSArray *charArray = @[@"string 1",@"String 21",@"string 12",@"String 11",@"String 02"];
NSStringCompareOptions comparisonOptions = NSCaseInsensitiveSearch|NSNumericSearch|
NSWidthInsensitiveSearch|NSForcedOrderingSearch;
NSComparator sort = ^(NSString *obj1,NSString *obj2){
NSRange range = NSMakeRange(0,obj1.length);
return [obj1 compare:obj2 options:comparisonOptions range:range];
};
NSArray *resultArray2 = [charArray sortedArrayUsingComparator:sort];
NSLog(@"字符串数组排序结果%@",resultArray2);