engine/utils/array.go

29 lines
453 B
Go
Raw Normal View History

2024-02-11 01:31:01 +08:00
package utils
import "strings"
func In(target string, array []string) bool {
target = strings.Trim(target, "")
for _, v := range array {
if strings.Trim(v, "") == target {
return true
}
}
return false
}
func RemoveRepeatSlice(in []string) (out []string) {
_map := make(map[string]bool)
for i := 0; i < len(in); i++ {
if in[i] != "" {
_map[in[i]] = true
}
}
for key, _ := range _map {
out = append(out, key)
}
return out
}