1 package stringslice 2 3 import "strings" 4 5 // Has returns true if the needle is in the haystack (case-sensitive) 6 func Has(haystack []string, needle string) bool { 7 for _, current := range haystack { 8 if current == needle { 9 return true 10 } 11 } 12 return false 13 } 14 15 // HasI returns true if the needle is in the haystack (case-insensitive) 16 func HasI(haystack []string, needle string) bool { 17 for _, current := range haystack { 18 if strings.ToLower(current) == strings.ToLower(needle) { 19 return true 20 } 21 } 22 return false 23 } 24