isASCII
A Boolean value indicating whether the Unicode scalar is an ASCII character.
Declaration
var isASCII: Bool { get }Discussion
ASCII characters have a scalar value between 0 and 127, inclusive. For example:
let canyon = "Cañón"
for scalar in canyon.unicodeScalars {
print(scalar, scalar.isASCII, scalar.value)
}
// Prints "C true 67"
// Prints "a true 97"
// Prints "ñ false 241"
// Prints "ó false 243"
// Prints "n true 110"