IntInSlice and StringInSlice functions

Refs https://github.com/tendermint/tendermint/pull/835
This commit is contained in:
Anton Kaliaev
2017-11-29 12:18:03 -06:00
parent 1e12754b3a
commit 33abe87c5b
4 changed files with 48 additions and 0 deletions

View File

@@ -43,3 +43,13 @@ func StripHex(s string) string {
}
return s
}
// StringInSlice returns true if a is found the list.
func StringInSlice(a string, list []string) bool {
for _, b := range list {
if b == a {
return true
}
}
return false
}