contains.go 187 B

123456789101112
  1. package helpers
  2. // contains checks if a string is present in a slice
  3. func Contains(s []int, str int) bool {
  4. for _, v := range s {
  5. if v == str {
  6. return true
  7. }
  8. }
  9. return false
  10. }