29 lines
453 B
Go
29 lines
453 B
Go
|
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
|
||
|
}
|