ctdo.de/func.go

43 lines
698 B
Go

package main
import (
"strings"
)
func ifFloatRange(variable float64, min float64, max float64, includeMin bool, includeMax bool) bool {
a, b := false, false
if includeMin {
a = variable >= min
} else {
a = variable > min
}
if includeMax {
b = variable <= max
} else {
b = variable < max
}
return a && b
}
func stringSplit(input string, sep string) []string {
output := *new([]string)
for _, element := range strings.Split(input, sep) {
if element != "" {
output = append(output, element)
}
}
return output
}
func stringListContains(list []string, searched string) bool {
for _, item := range list {
if item == searched {
return true
}
}
return false
}