http://www.jianshu.com/p/d3f343b71cc2 https://www.objccn.io/issue-9-2/

typedef NS_OPTIONS(NSUInteger, NSStringCompareOptions) {
    NSCaseInsensitiveSearch = 1,
    NSLiteralSearch = 2,		/* Exact character-by-character equivalence */
    NSBackwardsSearch = 4,		/* Search from end of source string */
    NSAnchoredSearch = 8,		/* Search is limited to start (or end, if NSBackwardsSearch) of source string */
    NSNumericSearch = 64,		/* Added in 10.2; Numbers within strings are compared using numeric value, that is, Foo2.txt < Foo7.txt < Foo25.txt; only applies to compare methods, not find */
    NSDiacriticInsensitiveSearch NS_ENUM_AVAILABLE(10_5, 2_0) = 128, /* If specified, ignores diacritics (o-umlaut == o) */
    NSWidthInsensitiveSearch NS_ENUM_AVAILABLE(10_5, 2_0) = 256, /* If specified, ignores width differences ('a' == UFF41) */
    NSForcedOrderingSearch NS_ENUM_AVAILABLE(10_5, 2_0) = 512, /* If specified, comparisons are forced to return either NSOrderedAscending or NSOrderedDescending if the strings are equivalent but not strictly equal, for stability when sorting (e.g. "aaa" > "AAA" with NSCaseInsensitiveSearch specified) */
    NSRegularExpressionSearch NS_ENUM_AVAILABLE(10_7, 3_2) = 1024    /* Applies to rangeOfString:..., stringByReplacingOccurrencesOfString:..., and replaceOccurrencesOfString:... methods only; the search string is treated as an ICU-compatible regular expression; if set, no other options can apply except NSCaseInsensitiveSearch and NSAnchoredSearch */
};

| NSStringCompareOptions | |
| — | — |
| NSCaseInsensitiveSearch | 不区分大小写.然而在某些地方还有更复杂的情况。例如,在德国,“ß” 和 “SS”是等价的 |
| NSLiteralSearch | 区分大小写.它只在所有字符都用相同的方式组成的情况下才会返回相等 |
| NSBackwardsSearch | 从后往前搜索 |
| NSAnchoredSearch | 搜索限制范围的字符串 |
| NSNumericSearch | 它对字符串里的数字排序,所以 “Section 9” < “Section 20” < “Section 100.” |
| NSDiacriticInsensitiveSearch | “A” 等同于 “Å” 等同于 “Ä.” |
| NSWidthInsensitiveSearch |一些东亚文字(平假名和片假名)有全宽与半宽两种形式。 |
| NSForcedOrderingSearch | 忽略不区分大小写比较的选项 |
| NSRegularExpressionSearch | 只能应用于 rangeOfString:…, stringByReplacingOccurrencesOfString:…和 replaceOccurrencesOfString:…方法 |

NSMutableString *string = @"Do any additional setup after loading the view, typically from a nib.".mutableCopy;
    
[string replaceOccurrencesOfString:@"Do"
                        withString:@"todo"
                           options:NSCaseInsensitiveSearch
                             range:NSMakeRange(0, string.length)];