gowiki/pkg/core/helper.go

11 lines
200 B
Go

package core
// Contains checks if slice a contains string str
func Contains(str string, a []string) (int, bool) {
for i, s := range a {
if s == str {
return i, true
}
}
return -1, false
}