aboutsummaryrefslogtreecommitdiff
path: root/src/strings/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings/example_test.go')
-rw-r--r--src/strings/example_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/strings/example_test.go b/src/strings/example_test.go
index 099d8c1cdc..fa34a8099f 100644
--- a/src/strings/example_test.go
+++ b/src/strings/example_test.go
@@ -137,6 +137,16 @@ func ExampleLastIndex() {
// -1
}
+func ExampleLastIndexAny() {
+ fmt.Println(strings.LastIndexAny("go gopher", "go"))
+ fmt.Println(strings.LastIndexAny("go gopher", "rodent"))
+ fmt.Println(strings.LastIndexAny("go gopher", "fail"))
+ // Output:
+ // 4
+ // 8
+ // -1
+}
+
func ExampleJoin() {
s := []string{"foo", "bar", "baz"}
fmt.Println(strings.Join(s, ", "))