aboutsummaryrefslogtreecommitdiff
path: root/src/strings
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings')
-rw-r--r--src/strings/example_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/strings/example_test.go b/src/strings/example_test.go
index 473b8c3833..e9621522ef 100644
--- a/src/strings/example_test.go
+++ b/src/strings/example_test.go
@@ -234,6 +234,14 @@ func ExampleTrim() {
// Output: ["Achtung! Achtung"]
}
+func ExampleTrimFunc() {
+ f := func(c rune) bool {
+ return !unicode.IsLetter(c) && !unicode.IsNumber(c)
+ }
+ fmt.Printf("[%q]", strings.TrimFunc(" Achtung1! Achtung2,...", f))
+ // Output: ["Achtung1! Achtung2"]
+}
+
func ExampleMap() {
rot13 := func(r rune) rune {
switch {