blob: e846c3038a1ca92c929f5865a2506da83da5c067 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<h1> Package utf16 </h1> <ul id="short-nav">
<li><code>import "unicode/utf16"</code></li>
<li><a href="#pkg-overview" class="overviewLink">Overview</a></li>
<li><a href="#pkg-index" class="indexLink">Index</a></li>
</ul> <h2 id="pkg-overview">Overview </h2> <p>Package utf16 implements encoding and decoding of UTF-16 sequences. </p> <h2 id="pkg-index">Index </h2> <ul id="manual-nav">
<li><a href="#AppendRune">func AppendRune(a []uint16, r rune) []uint16</a></li>
<li><a href="#Decode">func Decode(s []uint16) []rune</a></li>
<li><a href="#DecodeRune">func DecodeRune(r1, r2 rune) rune</a></li>
<li><a href="#Encode">func Encode(s []rune) []uint16</a></li>
<li><a href="#EncodeRune">func EncodeRune(r rune) (r1, r2 rune)</a></li>
<li><a href="#IsSurrogate">func IsSurrogate(r rune) bool</a></li>
</ul> <h3>Package files</h3> <p> <span>utf16.go</span> </p> <h2 id="AppendRune">func <span>AppendRune</span> <span title="Added in Go 1.20">1.20</span> </h2> <pre data-language="go">func AppendRune(a []uint16, r rune) []uint16</pre> <p>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. </p>
<h2 id="Decode">func <span>Decode</span> </h2> <pre data-language="go">func Decode(s []uint16) []rune</pre> <p>Decode returns the Unicode code point sequence represented by the UTF-16 encoding s. </p>
<h2 id="DecodeRune">func <span>DecodeRune</span> </h2> <pre data-language="go">func DecodeRune(r1, r2 rune) rune</pre> <p>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. </p>
<h2 id="Encode">func <span>Encode</span> </h2> <pre data-language="go">func Encode(s []rune) []uint16</pre> <p>Encode returns the UTF-16 encoding of the Unicode code point sequence s. </p>
<h2 id="EncodeRune">func <span>EncodeRune</span> </h2> <pre data-language="go">func EncodeRune(r rune) (r1, r2 rune)</pre> <p>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. </p>
<h2 id="IsSurrogate">func <span>IsSurrogate</span> </h2> <pre data-language="go">func IsSurrogate(r rune) bool</pre> <p>IsSurrogate reports whether the specified Unicode code point can appear in a surrogate pair. </p><div class="_attribution">
<p class="_attribution-p">
© Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br>
<a href="http://golang.org/pkg/unicode/utf16/" class="_attribution-link">http://golang.org/pkg/unicode/utf16/</a>
</p>
</div>
|