package main import ( "fmt" "sort" ) func main() { str := []string{"我", "是", "d", "b","c", } sort.Strings(str) fmt.Println(str) ints := []int{5,4,3,2,1} sort.Ints(ints) fmt.Println(ints) floats := []float64{1.1, 0.4, 9.3, 2.1} sort.Float64s(floats) fmt.Println(floats) uints := []uint8{4,2,1,5,5} sort.Slice(uints, func(i, j int) bool { return uints[i] < uints[j] }) fmt.Println(uints) }