Skip to content

Commit

Permalink
adds SliceContainsInt()
Browse files Browse the repository at this point in the history
  • Loading branch information
jritsema committed Nov 11, 2021
1 parent 383ab09 commit 3ea5a04
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,14 @@ func SliceContainsLike(s *[]string, e string) bool {
}
return false
}

//SliceContainsInt returns true if a slice contains an int
func SliceContainsInt(i *[]int, e int) bool {
for _, item := range *i {
if item == e {
return true
}
}
return false
}

0 comments on commit 3ea5a04

Please sign in to comment.