aboutsummaryrefslogtreecommitdiff
path: root/src/strings/example_test.go
diff options
context:
space:
mode:
authorPablo Santiago Blum de Aguiar <scorphus@gmail.com>2017-07-15 12:13:45 -0600
committerIan Lance Taylor <iant@golang.org>2017-07-15 20:38:29 +0000
commit9c5eadf41379b53db38787e70012eeb2de8f41c9 (patch)
tree883eab2804ce4ce432679d42ef0cd2e6330c2ca7 /src/strings/example_test.go
parenta83d0175a832eae170bee146b0f6743b02fbc59f (diff)
downloadgo-9c5eadf41379b53db38787e70012eeb2de8f41c9.tar.xz
strings: add example for IndexByte
Change-Id: Ib6a59735381ce744553f1ac96eeb65a194c8da10 Reviewed-on: https://go-review.googlesource.com/48860 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/strings/example_test.go')
-rw-r--r--src/strings/example_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/strings/example_test.go b/src/strings/example_test.go
index fa34a8099f..d9e31ea770 100644
--- a/src/strings/example_test.go
+++ b/src/strings/example_test.go
@@ -119,6 +119,15 @@ func ExampleIndexAny() {
// -1
}
+func ExampleIndexByte() {
+ fmt.Println(strings.IndexByte("golang", 'g'))
+ fmt.Println(strings.IndexByte("gophers", 'h'))
+ fmt.Println(strings.IndexByte("golang", 'x'))
+ // Output:
+ // 0
+ // 3
+ // -1
+}
func ExampleIndexRune() {
fmt.Println(strings.IndexRune("chicken", 'k'))
fmt.Println(strings.IndexRune("chicken", 'd'))