asciiValue
The ASCII encoding value of this character, if it is an ASCII character.
var asciiValue: UInt8? { get }
let chars: [Character] = ["a", " ", "™"]
for ch in chars {
print(ch, "-->", ch.asciiValue)
}
// Prints:
// a --> Optional(97)
// --> Optional(32)
// ™ --> nil
A character with the value “\r\n” (CR-LF) is normalized to “\n” (LF) and has an asciiValue
property equal to 10.
let cr = "\r" as Character
// cr.asciiValue == 13
let lf = "\n" as Character
// lf.asciiValue == 10
let crlf = "\r\n" as Character
// crlf.asciiValue == 10