3
0
corteza/pkg/ql/util.go
2022-05-20 15:37:33 +02:00

21 lines
351 B
Go

package ql
import (
"regexp"
"strings"
)
var (
truthy = regexp.MustCompile(`^(t(rue)?|y(es)?|1)$`)
)
// Check what boolean value the given string conforms to
func evalBool(v string) bool {
return truthy.MatchString(strings.ToLower(v))
}
// Check if the given string is a float
func isFloaty(v string) bool {
return strings.Contains(v, ".")
}