diff options
Diffstat (limited to 'match/prefix.go')
| -rw-r--r-- | match/prefix.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/match/prefix.go b/match/prefix.go new file mode 100644 index 0000000..d54902d --- /dev/null +++ b/match/prefix.go @@ -0,0 +1,15 @@ +package match + +import "strings" + +// Prefix is a simple Matcher, if the word is it's prefix, there is a match +type Prefix string + +func (a Prefix) String() string { + return string(a) +} + +// Match returns true if a has the prefix as prefix +func (a Prefix) Match(prefix string) bool { + return strings.HasPrefix(string(a), prefix) +} |
