From: Evan Hicks Date: Sat, 15 Jul 2017 18:07:04 +0000 (-0600) Subject: strings: add example for LastIndexAny X-Git-Tag: go1.9rc1~53 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1bca6a5ebcc4c624b8f3ef0b7c0df2f6db0507d3;p=gostls13.git 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 --- 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, ", "))