Commit ced46c62 authored by Tony Walker's avatar Tony Walker Committed by Bryan Mills

sort: add example for Strings

Change-Id: I33f0e2362e85287b493d9279d43b760733e2abcb
Reviewed-on: https://go-review.googlesource.com/48831
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBryan Mills <bcmills@google.com>
parent 5f7b3fab
...@@ -69,3 +69,10 @@ func ExampleSliceStable() { ...@@ -69,3 +69,10 @@ func ExampleSliceStable() {
// Output: By name: [{Alice 25} {Alice 75} {Alice 75} {Bob 75} {Bob 25} {Colin 25} {Elizabeth 75} {Elizabeth 25}] // Output: By name: [{Alice 25} {Alice 75} {Alice 75} {Bob 75} {Bob 25} {Colin 25} {Elizabeth 75} {Elizabeth 25}]
// By age,name: [{Alice 25} {Bob 25} {Colin 25} {Elizabeth 25} {Alice 75} {Alice 75} {Bob 75} {Elizabeth 75}] // By age,name: [{Alice 25} {Bob 25} {Colin 25} {Elizabeth 25} {Alice 75} {Alice 75} {Bob 75} {Elizabeth 75}]
} }
func ExampleStrings() {
s := []string{"Go", "Bravo", "Gopher", "Alpha", "Grin", "Delta"}
sort.Strings(s)
fmt.Println(s)
// Output: [Alpha Bravo Delta Go Gopher Grin]
}
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