What normalization is used when comparing Swift strings?

Elsewhere, I saw him say that Swift comparisons use NFD normalization.

However running on the iSwift playground I found that

print("\u{0071}\u{0307}\u{0323}" == "\u{0071}\u{0323}\u{0307}"); 

gives false , despite this example, right from the "Canonical Equivalence" standard that Swift Documentation Applications follow .

So, what canonicalization is done by Swift, and is this a mistake?

+5
source share
1 answer

It seems that this was a bug in Swift, which has since been fixed. With Swift 3 and Xcode 8.0,

 print("\u{0071}\u{0307}\u{0323}" == "\u{0071}\u{0323}\u{0307}") 

now displays true .

+2
source

Source: https://habr.com/ru/post/1241936/


All Articles