klyn.String.fromCodePoint
method
public static fromCodePoint(value as Int) as String
Description

Builds a string from one Unicode scalar value.

Values in the Basic Multilingual Plane produce one UTF-16 code unit. Supplementary values produce the required high and low surrogate pair. Surrogate code points are rejected because they are not Unicode scalar values on their own.

Parameters
ParameterDescription
valueUnicode scalar value in 0x0000..0x10FFFF.
Returns

A string containing the represented Unicode character.

Throws
  • ValueException if the value is outside the Unicode range or is an isolated surrogate code point.
Example
assert String.fromCodePoint(0x03C0) == "\u03C0"
assert String.fromCodePoint(0x1F600) == "\U0001F600"