21 lines
401 B
Go
21 lines
401 B
Go
|
|
package placement
|
||
|
|
|
||
|
|
import "strings"
|
||
|
|
|
||
|
|
func MatchesExclusion(text string, exclusions []string) bool {
|
||
|
|
text = strings.ToLower(strings.TrimSpace(text))
|
||
|
|
if text == "" || len(exclusions) == 0 {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
for _, rule := range exclusions {
|
||
|
|
rule = strings.ToLower(strings.TrimSpace(rule))
|
||
|
|
if rule == "" {
|
||
|
|
continue
|
||
|
|
}
|
||
|
|
if strings.Contains(text, rule) {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
}
|