29 lines
525 B
Go
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
|
|
}
|