diff options
Diffstat (limited to 'modules/util/compare.go')
-rw-r--r-- | modules/util/compare.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/util/compare.go b/modules/util/compare.go index c61e7965ae..f1d1e5718e 100644 --- a/modules/util/compare.go +++ b/modules/util/compare.go @@ -35,6 +35,16 @@ func ExistsInSlice(target string, slice []string) bool { return i < len(slice) } +// IsStringInSlice sequential searches if string exists in slice. +func IsStringInSlice(target string, slice []string) bool { + for i := 0; i < len(slice); i++ { + if slice[i] == target { + return true + } + } + return false +} + // IsEqualSlice returns true if slices are equal. func IsEqualSlice(target []string, source []string) bool { if len(target) != len(source) { |