aboutsummaryrefslogtreecommitdiff
path: root/src/bytes/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytes/example_test.go')
-rw-r--r--src/bytes/example_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bytes/example_test.go b/src/bytes/example_test.go
index 252be8c473..6a7ce59f55 100644
--- a/src/bytes/example_test.go
+++ b/src/bytes/example_test.go
@@ -153,6 +153,14 @@ func ExampleCount() {
// 5
}
+func ExampleEqual() {
+ fmt.Println(bytes.Equal([]byte("Go"), []byte("Go")))
+ fmt.Println(bytes.Equal([]byte("Go"), []byte("go")))
+ // Output:
+ // true
+ // false
+}
+
func ExampleEqualFold() {
fmt.Println(bytes.EqualFold([]byte("Go"), []byte("go")))
// Output: true
@@ -188,6 +196,14 @@ func ExampleIndex() {
// -1
}
+func ExampleIndexByte() {
+ fmt.Println(bytes.IndexByte([]byte("chicken"), byte('k')))
+ fmt.Println(bytes.IndexByte([]byte("chicken"), byte('g')))
+ // Output:
+ // 4
+ // -1
+}
+
func ExampleIndexFunc() {
f := func(c rune) bool {
return unicode.Is(unicode.Han, c)