mirror of
https://github.com/golang/go
synced 2024-11-23 20:30:04 -07:00
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>
This commit is contained in:
parent
41af3fa33e
commit
1bca6a5ebc
@ -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, ", "))
|
||||
|
Loading…
Reference in New Issue
Block a user