Last active
September 17, 2020 14:07
-
-
Save Koze/21024d4ef744089d79be82dedd939a64 to your computer and use it in GitHub Desktop.
The test for Equatable of precomposed characters of Unicode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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