From 1bca6a5ebcc4c624b8f3ef0b7c0df2f6db0507d3 Mon Sep 17 00:00:00 2001 From: Evan Hicks Date: Sat, 15 Jul 2017 12:07:04 -0600 Subject: [PATCH] strings: add example for LastIndexAny Change-Id: I69d1359d8868d4c5b173e4d831e38cea7dfeb713 Reviewed-on: https://go-review.googlesource.com/48859 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/strings/example_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) 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, ", ")) -- 2.50.0