NSMutableArray *siftArray = [NSMutableArray
array];
NSArray *sources =
@[@"dfersa",@"adfae",@"frdg",@"rfde",@"drgs",@"wser",@"rfdt",@"pkoi"];
// [self.sources addObjectsFromArray : [JKCountryResout searchCountryNameByStrings:@"china"]];
for (NSString *str
in self.sources){
NSString *resoultStr = [str
substringToIndex:1];
[siftArray
addObject:resoultStr];
}
NSSet *set = [NSSet
setWithArray:siftArray];
NSArray *sortDesc =
@[[[NSSortDescriptor
alloc] initWithKey:nil
ascending:YES]];
NSArray *sortSetArray = [set
sortedArrayUsingDescriptors:sortDesc];
NSLog(@"排序的结果 %@", sortSetArray);
时间: 2024-12-21 23:11:37