Standard library / sort

sort.StringSlice.Sort()

Sorts the receiver in ascending order in place; does not guarantee stability. Expected stdout: '[a b c]\n'.

Formal Syntax & Structure

go syntaxgo
func (x StringSlice) Sort()

Working Example

Example Snippetgo
package main
import (  "fmt"  "sort")
func main() {  a := sort.StringSlice([]string{"c", "a", "b"})  a.Sort()  fmt.Println(a)}
Go Reference