utf16
2 分钟阅读
Package utf16 implements encoding and decoding of UTF-16 sequences.
utf16
包实现了UTF-16序列的编码和解码。
常量
This section is empty.
变量
This section is empty.
函数
func AppendRune <- go1.20
|
|
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.
AppendRune
函数将Unicode码点r的UTF-16编码追加到a
的末尾,并返回扩展后的缓冲区。如果r
不是有效的Unicode码点,则追加U+FFFD
的编码。
func Decode
|
|
Decode returns the Unicode code point sequence represented by the UTF-16 encoding s.
Decode
函数返回由UTF-16编码s
表示的Unicode码点序列。
func DecodeRune
|
|
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.
DecodeRune
函数返回代理对的UTF-16解码。如果代理对不是有效的UTF-16代理对,则DecodeRune
返回Unicode替换码点U+FFFD
。
func Encode
|
|
Encode returns the UTF-16 encoding of the Unicode code point sequence s.
Encode
函数返回Unicode码点序列s
的UTF-16编码。
func EncodeRune
|
|
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.
EncodeRune
函数返回给定rune的UTF-16代理对r1
、r2
。如果rune
不是有效的Unicode码点或不需要编码,则EncodeRune
返回U+FFFD
,U+FFFD
。
func IsSurrogate
|
|
IsSurrogate reports whether the specified Unicode code point can appear in a surrogate pair.
IsSurrogate
函数报告指定的Unicode码点是否可以出现在代理对中。
func RuneLen <- go1.23.0
|
|
RuneLen returns the number of 16-bit words in the UTF-16 encoding of the rune. It returns -1 if the rune is not a valid value to encode in UTF-16.
RuneLen
返回该 rune
在 UTF-16 编码中的 16 位字数。如果该 rune
不是一个有效的 UTF-16 编码值,则返回 -1。
类型
This section is empty.