[Golang] Sort Words Alphabetically
Go standard library provides sort.Strings to help us sort words alphabetically. The following example comes from Go official site.
package main
import (
"fmt"
"sort"
)
func main() {
s := []string{"Go", "Bravo", "Gopher", "Alpha", "Grin", "Delta"}
sort.Strings(s)
fmt.Println(s)
}
References:
[1] |
[2] | [Golang] Sort String by Character |