aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvan Hicks <evan.hicks2@gmail.com>2017-07-15 12:07:04 -0600
committerBrad Fitzpatrick <bradfitz@golang.org>2017-07-15 20:31:52 +0000
commit1bca6a5ebcc4c624b8f3ef0b7c0df2f6db0507d3 (patch)
tree1cc54b6fb0d5d65721f88c1265d10e8e41a2a663 /src
parent41af3fa33ed54c1cb2095385f723ba1636485a11 (diff)
downloadgo-1bca6a5ebcc4c624b8f3ef0b7c0df2f6db0507d3.tar.xz
strings: add example for LastIndexAny
Change-Id: I69d1359d8868d4c5b173e4d831e38cea7dfeb713 Reviewed-on: https://go-review.googlesource.com/48859 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
-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, ", "))