2021-06-24 07:43:28 +00:00
|
|
|
package util
|
|
|
|
|
2021-06-26 02:57:08 +00:00
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2021-06-26 02:57:08 +00:00
|
|
|
// 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
|
|
|
|
}
|