You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
465 B

package form
import (
"strings"
)
type tagOptions string
const delim rune = ','
func parseTag(tag string) (string, tagOptions) {
tag, opt, _ := strings.Cut(tag, string(delim))
return tag, tagOptions(opt)
}
func (o tagOptions) Contains(optionName string) bool {
if len(o) == 0 {
return false
}
s := string(o)
for s != "" {
var name string
if name, s, _ = strings.Cut(s, string(delim)); name == optionName {
return true
}
}
return false
}