bob/util/check.go

22 lines
374 B
Go
Raw Permalink Normal View History

2021-06-24 07:43:28 +00:00
package util
// IsIn checks if an array have a value
2021-06-24 07:43:28 +00:00
func IsIn(arr []string, value string) bool {
for _, item := range arr {
if item == value {
return true
}
}
return false
}
// FindPosition search for value position on an array
2021-06-24 07:43:28 +00:00
func FindPosition(arr []string, value string) int {
for i, item := range arr {
if item == value {
return i
}
}
return -1
}