util_test.go 373 B

1234567891011121314
  1. package service
  2. import (
  3. "strings"
  4. "testing"
  5. )
  6. func TestSliceUnique(t *testing.T) {
  7. var slice1 = []string{"绘画", "哈哈", "22", "2223", "绘画"}
  8. t.Logf("unique : %v", SliceUnique(Slice2Interface(slice1)))
  9. tag := "绘画, 哈哈, 22, 2223, 绘画"
  10. t.Logf("unique : %v", strings.Join(Slice2String(SliceUnique(Slice2Interface(strings.Split(tag, ",")))), ","))
  11. }