public class CodeUnit implements ValueType:
Represents one 16-bit UTF-16 code unit.
Characters in the Basic Multilingual Plane use one CodeUnit. Supplementary Unicode characters use a surrogate pair and therefore occupy two CodeUnit values when represented as UTF-16. A \uXXXX escape denotes one code unit; a \UXXXXXXXX escape is accepted as a CodeUnit only when its value remains in the Basic Multilingual Plane. Use a String literal or an explicit surrogate pair for a supplementary character.
letter as CodeUnit = `a` assert letter.toUpper() == `A` high as CodeUnit = `\uD83D` low as CodeUnit = `\uDE00` assert String.fromCodePoint(0x1F600) == "\U0001F600"
| Modifier and Type | Member | Description |
|---|---|---|
| public native | CodeUnitCodeUnit() |
Builds the neutral CodeUnit value (\u0000). |
| public native | CodeUnit | Narrows a Basic Multilingual Plane Char to one UTF-16 code unit. |
| public native | CodeUnit | Creates a CodeUnit from another CodeUnit value. |
| public native | CodeUnit | Creates a CodeUnit from a signed UTF-16 code-unit value. |
| public native | CodeUnit | Creates a CodeUnit from a signed UTF-16 code-unit value. |
| public native | CodeUnit | Creates a CodeUnit from an unsigned UTF-16 code-unit value. |
| public native | CodeUnit | Creates a CodeUnit from an unsigned UTF-16 code-unit value. |
| Modifier and Type | Member | Description |
|---|---|---|
| public native | isAlnumisAlnum() as Boolean |
Determines whether a character is alphabetic or a digit. |
| public native | isAlphaisAlpha() as Boolean |
Determines whether a character belongs to a Unicode alphabetic class. |
| public native | isDigitisDigit() as Boolean |
Determines whether a character is a Unicode digit. |
| public native | toInttoInt() as Int |
Returns the unsigned numeric value of this UTF-16 code unit. |
| public native | toLowertoLower() as CodeUnit |
Converts a character to lowercase when a lowercase mapping exists. |
| public native | toUppertoUpper() as CodeUnit |
Converts a character to uppercase when an uppercase mapping exists. |