Commit 0b62ebfd authored by Francisco Rojas's avatar Francisco Rojas Committed by Heschi Kreinick

strings: add a example for Compare func

Add a example for string.Compare that return the three possible results.

Change-Id: I103cf39327c1868fb249538d9e22b11865ba4b70
Reviewed-on: https://go-review.googlesource.com/49011Reviewed-by: 's avatarHeschi Kreinick <heschi@google.com>
parent 6bfd2d19
......@@ -23,6 +23,16 @@ func ExampleFieldsFunc() {
// Output: Fields are: ["foo1" "bar2" "baz3"]
}
func ExampleCompare() {
fmt.Println(strings.Compare("a", "b"))
fmt.Println(strings.Compare("a", "a"))
fmt.Println(strings.Compare("b", "a"))
// Output:
// -1
// 0
// 1
}
func ExampleContains() {
fmt.Println(strings.Contains("seafood", "foo"))
fmt.Println(strings.Contains("seafood", "bar"))
......
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