常用类型及数据操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

41 lines
797 B

package helper
import (
"fmt"
"testing"
)
func Test_Diff(t *testing.T) {
var aa = []string{"43", "33"}
var bb = []string{"2", "33", "1"}
cc := Diff(aa, bb)
fmt.Println(cc)
}
func Test_Intersect(t *testing.T) {
var aa = []string{"43", "33"}
var bb = []string{"2", "33", "1"}
cc := Intersect(aa, bb)
fmt.Println(cc)
}
func Test_Union(t *testing.T) {
var aa = []string{"43", "33"}
var bb = []string{"2", "33", "1"}
cc := Union(aa, bb)
fmt.Println(cc)
}
func Test_Unique(t *testing.T) {
var str = []string{"1", "2", "2"}
ret, err := Unique(str)
fmt.Println(ret, err)
}
func Test_StringSliceSort(t *testing.T) {
var str = []string{"10", "2", "5"}
ret, err := StringSliceSort(str,"asc")
fmt.Println(ret, err)
ret2, err := StringSliceSort(str,"desc")
fmt.Println(ret2, err)
}