Package utf16 implements encoding and decoding of UTF-16 sequences.

Static methods

staticinlineappendRune(_a:Slice<GoUInt16>, _r:GoInt32):Slice<GoUInt16>

AppendRune appends the UTF-16 encoding of the Unicode code point r to the end of p and returns the extended buffer. If the rune is not a valid Unicode code point, it appends the encoding of U+FFFD.

staticinlinedecode(_s:Slice<GoUInt16>):Slice<GoInt32>

Decode returns the Unicode code point sequence represented by the UTF-16 encoding s.

staticinlinedecodeRune(_r1:GoInt32, _r2:GoInt32):GoInt32

DecodeRune returns the UTF-16 decoding of a surrogate pair. If the pair is not a valid UTF-16 surrogate pair, DecodeRune returns the Unicode replacement code point U+FFFD.

staticinlineencode(_s:Slice<GoInt32>):Slice<GoUInt16>

Encode returns the UTF-16 encoding of the Unicode code point sequence s.

staticinlineencodeRune(_r:GoInt32):{_1:GoInt32, _0:GoInt32}

EncodeRune returns the UTF-16 surrogate pair r1, r2 for the given rune. If the rune is not a valid Unicode code point or does not need encoding, EncodeRune returns U+FFFD, U+FFFD.

staticinlineisSurrogate(_r:GoInt32):Bool

IsSurrogate reports whether the specified Unicode code point can appear in a surrogate pair.