diff options
author | Jes Cok <xigua67damn@gmail.com> | 2024-03-07 21:36:47 +0800 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2024-03-07 19:08:48 +0000 |
commit | ef4f2a05972f9b729f5edb897d581f496675f588 (patch) | |
tree | 3fd678ebc37afce98536a25a35c6fd7a70296dd8 /doc | |
parent | e0ba596c15dd82aad021c0c812fda6ca14ce118a (diff) | |
download | go-ef4f2a05972f9b729f5edb897d581f496675f588.tar.gz go-ef4f2a05972f9b729f5edb897d581f496675f588.zip |
unicode/utf16: add func RuneLen
This CL adds func RuneLen, while here, also uses RuneLen to simplify
code in Encode.
Fixes #44940
Change-Id: Ifd3b537f69880dfd32a69a6733d8d3c2b5d4ecba
Reviewed-on: https://go-review.googlesource.com/c/go/+/569755
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/next/6-stdlib/99-minor/unicode/utf16/44940.md | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/doc/next/6-stdlib/99-minor/unicode/utf16/44940.md b/doc/next/6-stdlib/99-minor/unicode/utf16/44940.md new file mode 100644 index 0000000000..79a36cd611 --- /dev/null +++ b/doc/next/6-stdlib/99-minor/unicode/utf16/44940.md @@ -0,0 +1,3 @@ +The [`unicode/utf16.RuneLen`](/pkg/unicode/utf16#RuneLen) function 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. |