From: Pablo Santiago Blum de Aguiar Date: Sat, 15 Jul 2017 18:13:45 +0000 (-0600) Subject: strings: add example for IndexByte X-Git-Tag: go1.9rc1~51 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9c5eadf41379b53db38787e70012eeb2de8f41c9;p=gostls13.git strings: add example for IndexByte Change-Id: Ib6a59735381ce744553f1ac96eeb65a194c8da10 Reviewed-on: https://go-review.googlesource.com/48860 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 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'))