diff options
| author | Michael Brandenburg <mbrandenburg@bolste.com> | 2017-07-26 20:25:37 -0700 |
|---|---|---|
| committer | Joe Tsai <thebrokentoaster@gmail.com> | 2017-08-22 21:31:54 +0000 |
| commit | 6cbe5c8ac342ad3d8f907caf105feaa55cb0404b (patch) | |
| tree | 7d63e69fecf5e7d81aebb95ed5cbf3b4bfb7ddc8 /src/bytes | |
| parent | d4dc26c0adbe7976ac625c01bb21e85511cd00fd (diff) | |
| download | go-6cbe5c8ac342ad3d8f907caf105feaa55cb0404b.tar.xz | |
bytes: add examples for TrimLeft and TrimRight
Change-Id: Ib6d94f185dd43568cf97ef267dd51a09f43a402f
Reviewed-on: https://go-review.googlesource.com/51391
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/bytes')
| -rw-r--r-- | src/bytes/example_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bytes/example_test.go b/src/bytes/example_test.go index 93972770ab..43d19e186b 100644 --- a/src/bytes/example_test.go +++ b/src/bytes/example_test.go @@ -281,11 +281,23 @@ func ExampleMap() { // Output: 'Gjnf oevyyvt naq gur fyvgul tbcure... } +func ExampleTrimLeft() { + fmt.Print(string(bytes.TrimLeft([]byte("+ 005400"), "+0 "))) + // Output: + // 5400 +} + func ExampleTrimSpace() { fmt.Printf("%s", bytes.TrimSpace([]byte(" \t\n a lone gopher \n\t\r\n"))) // Output: a lone gopher } +func ExampleTrimRight() { + fmt.Print(string(bytes.TrimRight([]byte("453gopher8257"), "0123456789"))) + // Output: + // 453gopher +} + func ExampleToUpper() { fmt.Printf("%s", bytes.ToUpper([]byte("Gopher"))) // Output: GOPHER |
