NSStringCompareOptions

NSStringCompareOptions
多個(gè)字符串類的搜索和比較方法的可用選項(xiàng)

typedef NS_OPTIONS(NSUInteger, NSStringCompareOptions) {
    NSCaseInsensitiveSearch = 1,//不區(qū)分大小寫的搜索
    NSLiteralSearch = 2,        /* 精確的逐個(gè)字符串等價(jià)。Exact character-by-character equivalence */
    NSBackwardsSearch = 4,      /*從源字符串的末尾搜索、 Search from end of source string */
    NSAnchoredSearch = 8,       /*搜索僅限于開始(或結(jié)束,如果是從末尾開始的搜索)源字符串 Search is limited to start (or end, if NSBackwardsSearch) of source string */
    NSNumericSearch = 64,       /*。用字符串中的數(shù)字的值進(jìn)行比較, 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, /*搜索忽略變音符號(hào)。 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, /* 如果字符串是等效的但不是嚴(yán)格相等的,比較會(huì)被強(qiáng)制返回same,例如 "aaa"和"AAA"。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 */
};

NSRegularExpressionSearch:只在rangeOfString:...、stringByReplacingOccurrencesOfString:...replaceOccurrencesOfString:...方法中適用。搜索字符串被視為與ICU兼容的正則表達(dá)式。如果設(shè)置了這個(gè)選項(xiàng),那么其余選項(xiàng)除了NSCaseInsensitiveSearchNSAnchoredSearch,別的都不能使用

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容