sort code
This commit is contained in:
parent
c1addcaab4
commit
5a2e750fe1
@ -74,3 +74,4 @@ func main() {
|
||||
// concurrency
|
||||
// reconnection
|
||||
// errors
|
||||
// redis url
|
||||
|
20
084-sort.go
20
084-sort.go
@ -1,12 +1,20 @@
|
||||
package main
|
||||
package main
|
||||
|
||||
import ("fmt"; "sort")
|
||||
import "fmt"
|
||||
import "sort"
|
||||
|
||||
func main() {
|
||||
strs := []string{"foo", "bar", "bat"}
|
||||
fmt.Println(strs)
|
||||
fmt.Println()
|
||||
|
||||
strs := []string{"c", "a", "b"}
|
||||
sort.Strings(strs)
|
||||
fmt.Println(strs)
|
||||
|
||||
ints := []int{7, 2, 4}
|
||||
sort.Ints(ints)
|
||||
fmt.Println(ints)
|
||||
}
|
||||
|
||||
/*
|
||||
$ go run sort.go
|
||||
[foo bar bat]
|
||||
[2 4 7]
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user