klyn.String.toCodeUnitArray
method
public toCodeUnitArray() as CodeUnit[]:
Description

Encodes this text as UTF-16 code units.

Supplementary Unicode scalars produce a high/low surrogate pair, so the returned array may contain more items than size.

Returns

UTF-16 representation of this string.

Example
values = "A😀B".toCodeUnitArray()
assert values.size == 4
assert values[1] == `\uD83D`
assert values[2] == `\uDE00`