go_dreamfactory/utils/strings.go
2022-06-09 18:45:50 +08:00

27 lines
433 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
}