This commit is contained in:
Your Name
2018-03-07 15:31:02 +03:00
parent 8f91676943
commit 26296c2cc7
5 changed files with 296 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
package utils
func Contains(slice []string, item string) bool {
set := make(map[string]struct{}, len(slice))
for _, s := range slice {
set[s] = struct{}{}
}
_, ok := set[item]
return ok
}