diff options
| author | jiahua wang <wjh180909@gmail.com> | 2021-10-07 15:30:03 +0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2021-11-05 21:29:18 +0000 |
| commit | 75952abc6a8a8ad09e6bb1966c66b9a68b5d6c4e (patch) | |
| tree | 9a33f6bf8782963bb40175809f4513adc2e47709 /src/unicode/utf8/example_test.go | |
| parent | fb8b1764d8e8afdaf5d8fd00af3720e42d96ad9c (diff) | |
| download | go-75952abc6a8a8ad09e6bb1966c66b9a68b5d6c4e.tar.xz | |
unicode/utf8: add AppendRune Example
Also, correct TestAppendRune error message.
Change-Id: I3ca3ac7051af1ae6d449381b78efa86c2f6be8ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/354529
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Trust: Robert Findley <rfindley@google.com>
Trust: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/unicode/utf8/example_test.go')
| -rw-r--r-- | src/unicode/utf8/example_test.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/unicode/utf8/example_test.go b/src/unicode/utf8/example_test.go index 5cd931d242..fe434c9476 100644 --- a/src/unicode/utf8/example_test.go +++ b/src/unicode/utf8/example_test.go @@ -214,3 +214,13 @@ func ExampleValidString() { // true // false } + +func ExampleAppendRune() { + buf1 := utf8.AppendRune(nil, 0x10000) + buf2 := utf8.AppendRune([]byte("init"), 0x10000) + fmt.Println(string(buf1)) + fmt.Println(string(buf2)) + // Output: + // ๐ + // init๐ +} |
