From ef4f2a05972f9b729f5edb897d581f496675f588 Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Thu, 7 Mar 2024 21:36:47 +0800 Subject: 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 Reviewed-by: Michael Knyszek Commit-Queue: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Auto-Submit: Ian Lance Taylor --- doc/next/6-stdlib/99-minor/unicode/utf16/44940.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 doc/next/6-stdlib/99-minor/unicode/utf16/44940.md (limited to 'doc') 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. -- cgit v1.2.3-54-g00ecf