Commit a0ba7363 authored by Kate Manson's avatar Kate Manson Committed by Heschi Kreinick

strings: add example for ContainsRune

Change-Id: I994f003c97a14d194df5f07dd217c0ff3b214741
Reviewed-on: https://go-review.googlesource.com/48874Reviewed-by: default avatarMatt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
parent 4f299f93
...@@ -47,6 +47,16 @@ func ExampleContainsAny() { ...@@ -47,6 +47,16 @@ func ExampleContainsAny() {
// false // 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() { func ExampleCount() {
fmt.Println(strings.Count("cheese", "e")) fmt.Println(strings.Count("cheese", "e"))
fmt.Println(strings.Count("five", "")) // before & after each rune fmt.Println(strings.Count("five", "")) // before & after each rune
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment