aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sort/example_test.go7
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]
+}