在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
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) }
|
请发表评论