The test for Equatable of precomposed characters of Unicode.
func unicodeCodePointsToString(_ codePoints :[UInt32]) -> String { | |
let unicodeScalars = codePoints.compactMap { Unicode.Scalar($0) } | |
let characters = unicodeScalars.map { Character($0) } | |
let string = String(characters) | |
return string | |
} | |
// HIRAGANA LETTER GA | |
let ga = unicodeCodePointsToString([0x304C]) | |
// HIRAGANA LETTER KA, COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK | |
let kaPlusDakuten = unicodeCodePointsToString([0x304B, 0x3099]) | |
print(ga == kaPlusDakuten) // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment