aboutsummaryrefslogtreecommitdiff
path: root/src/strings/example_test.go
diff options
context:
space:
mode:
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'))