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.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/strings/example_test.go b/src/strings/example_test.go
index 3f9d63b5a4..099d8c1cdc 100644
--- a/src/strings/example_test.go
+++ b/src/strings/example_test.go
@@ -47,6 +47,16 @@ func ExampleContainsAny() {
// false
}
+func ExampleContainsRune() {
+ // Finds whether a string contains a particular Unicode code point.
+ // The code point for the lowercase letter "a", for example, is 97.
+ fmt.Println(strings.ContainsRune("aardvark", 97))
+ fmt.Println(strings.ContainsRune("timeout", 97))
+ // Output:
+ // true
+ // false
+}
+
func ExampleCount() {
fmt.Println(strings.Count("cheese", "e"))
fmt.Println(strings.Count("five", "")) // before & after each rune