NSString字符串比较

1.1 NSString字符串比较

typedef NS_OPTIONS(NSUInteger, NSStringCompareOptions) {

NSCaseInsensitiveSearch = 1, // 不区分大小写比较
        NSLiteralSearch = 2, // 区分大小写比较
        NSBackwardsSearch = 4, // 从字符串末尾开始搜索
        NSAnchoredSearch = 8, // 搜索限制范围的字符串�
        NSNumbericSearch = 64 // 按照字符串里的数字为依据,算出顺序。例如 Foo2.txt < Foo7.txt < Foo25.txt   
};

1.2 Options枚举 区分大小写排序

    NSArray *resultArray = [paramArray sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        return [obj1 compare:obj2 options:NSLiteralSearch];
    }];

总结:

一般使用在加密过程中大写排序

你可能感兴趣的:(NSString字符串比较)