diff options
author | Tony Walker <walkert.uk@gmail.com> | 2017-07-15 22:27:29 +0000 |
---|---|---|
committer | Bryan Mills <bcmills@google.com> | 2017-07-15 23:17:23 +0000 |
commit | ced46c628877d9277a70c986467c1aff5f0b412c (patch) | |
tree | d0121b1901344e074107c56a7b0a2fd29aeeeffe | |
parent | 5f7b3fabe1baeb8d71c68af38604f067fe13287a (diff) | |
download | go-ced46c628877d9277a70c986467c1aff5f0b412c.tar.gz go-ced46c628877d9277a70c986467c1aff5f0b412c.zip |
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: Bryan Mills <bcmills@google.com>
-rw-r--r-- | src/sort/example_test.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/sort/example_test.go b/src/sort/example_test.go index 89ebe790c1..f8d8491bc4 100644 --- a/src/sort/example_test.go +++ b/src/sort/example_test.go @@ -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}] // 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] +} |