This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
|
package utils
|
|
|
|
func Contains[T comparable](slice []T, item T) bool {
|
|
for _, i := range slice {
|
|
if i == item {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func Count[T comparable](slice []T, item T) int {
|
|
z := 0
|
|
for _, i := range slice {
|
|
if i == item {
|
|
z++
|
|
}
|
|
}
|
|
return z
|
|
}
|