mirror of https://github.com/gobwas/glob.git
24 lines
373 B
Go
24 lines
373 B
Go
package match
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
type Contains struct {
|
|
Needle string
|
|
Not bool
|
|
}
|
|
|
|
func (self Contains) Match(s string) bool {
|
|
return strings.Contains(s, self.Needle) != self.Not
|
|
}
|
|
|
|
func (self Contains) Kind() Kind {
|
|
return KindContains
|
|
}
|
|
|
|
func (self Contains) String() string {
|
|
return fmt.Sprintf("[contains:needle=%s not=%t]", self.Needle, self.Not)
|
|
}
|