OC之按中文排序(localizedStandardCompare)
1 NSArray *arrs=@[@"小雨",@"安安",@"小风",@"荣荣",@"张涛",@"李文荣"]; 2 NSArray *sortarr=[arrs sortedArrayUsingComparator:^NSComparisonResult(id obj1,id obj2){ 3 return [obj1 localizedStandardCompare:obj2];//localizedStandardCompare中文按照拼音的首字母排序 4 }]; 5 for(id str in sortarr){ 6 NSLog(@"%@",str); 7 }