2023-04-28 14:57:21 +02:00
|
|
|
package internal
|
|
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
2023-05-04 11:44:27 +02:00
|
|
|
func parseCommaDelimited(data string) []string {
|
2023-04-28 14:57:21 +02:00
|
|
|
out := make([]string, 0, strings.Count(data, ",")+1)
|
2023-05-04 11:44:27 +02:00
|
|
|
for _, item := range strings.Split(data, ",") {
|
|
|
|
|
if w := strings.TrimSpace(item); w != "" {
|
2023-04-28 23:09:40 +02:00
|
|
|
out = append(out, w)
|
|
|
|
|
}
|
2023-04-28 14:57:21 +02:00
|
|
|
}
|
|
|
|
|
return out
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Contains[T comparable](haystack []T, needle T) bool {
|
|
|
|
|
for _, v := range haystack {
|
|
|
|
|
if v == needle {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|