30 lines
488 B
Go
30 lines
488 B
Go
package main
|
|
|
|
import "strings"
|
|
|
|
func StringHasAny(s string, subs ...string) bool {
|
|
for _, sub := range subs {
|
|
if strings.Contains(s, sub) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func StringHasPrefix(s string, subs ...string) bool {
|
|
for _, sub := range subs {
|
|
if strings.HasPrefix(s, sub) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
func StringHasSuffix(s string, subs ...string) bool {
|
|
for _, sub := range subs {
|
|
if strings.HasSuffix(s, sub) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|