dorfylegends/backend/util/util.go
Robert Janetzko 77b720f8d2 restructure
2022-04-14 13:59:47 +00:00

29 lines
525 B
Go

package util
import "strings"
func Keys[K comparable, V any](input map[K]V) []K {
keys := make([]K, 0, len(input))
for k := range input {
keys = append(keys, k)
}
return keys
}
func Values[K comparable, V any](input map[K]V) []V {
values := make([]V, 0, len(input))
for _, v := range input {
values = append(values, v)
}
return values
}
func ContainsAny(s string, substrings ...string) bool {
for _, substring := range substrings {
if strings.Contains(s, substring) {
return true
}
}
return false
}