Swiftで大文字と小文字を区別しない文字列を比較する方法には違いがありますか?対大文字小文字の区別がない文字列の比較
let equal = str1.lowercased() == str2.lowercased() // or uppercased()
:
let equal = str1.caseInsensitiveCompare(str2) == .orderedSame
1は誤った結果を返す任意の言語でどのような場合はありますか? 私は、パフォーマンスよりもUnicodeの正確さに関心があります。
caseInsensitiveCompare' 'の呼び出しが最終的に落下【のCFStringのCFStringCompareWithOptionsAndLocale(https://github.com/apple/swift-corelibs-foundation/blob/e48175bca494b8a6dc22079af42dbd66c0805eda/CoreFoundation/String.subproj/CFString.c#L2553) 'kCFCompareCaseInsensitive'を指定します。あなたはその周辺の洞察のための論理を見るかもしれません。 – Undo