go_dreamfactory/utils/strings.go
2022-06-10 14:20:25 +08:00

37 lines
585 B
Go

package utils
import (
"strings"
"go_dreamfactory/lego/sys/log"
)
func ParseP(p string) (string, string, bool) {
s := strings.SplitN(p, ".", 2)
if len(s) < 2 {
log.Debugf("param P err: %s", p)
return "", "", false
}
return s[0], s[1], true
}
func Find(slice []string, val string) (int, bool) {
for i, item := range slice {
if item == val {
return i, true
}
}
return -1, false
}
func DeleteString(list []string, ele string) []string {
result := make([]string, 0)
for _, v := range list {
if v != ele {
result = append(result, v)
}
}
return result
}