diff --git a/src/duplicacy_utils.go b/src/duplicacy_utils.go index 1bfa728..de18c90 100644 --- a/src/duplicacy_utils.go +++ b/src/duplicacy_utils.go @@ -474,3 +474,24 @@ func MinInt(x, y int) int { } return y } + +// Contains tells whether a contains x. +func Contains(a []string, x string) bool { + for _, n := range a { + if x == n { + return true + } + } + return false +} + +// Find returns the smallest index i at which x == a[i], +// or len(a) if there is no such index. +func Find(a []string, x string) int { + for i, n := range a { + if x == n { + return i + } + } + return len(a) +} \ No newline at end of file