aboutsummaryrefslogtreecommitdiff
path: root/src/bytes/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytes/example_test.go')
-rw-r--r--src/bytes/example_test.go12
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