当前位置:

Objective-C 对字符串数组排序_IOS_移动开发

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSArray* array = [NSArray arrayWithObjects:@"RaspBerry", @"Peach", @"Banana", @"BlackBerry", @"BlueBerry", @"Apple", nil];
        NSLog(@"%@", array);
        
        NSArray* arraySorted = [array sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
        NSLog(@"%@", arraySorted);
    }
    return 0;
}



评论:

登录后发表评论




2023.01.28 群组聊天