Files
go-easy-utils/sliceUtil/in_slice.go
jeffery 9a8c60b30a Feature/generic type (#19)
Supports generics and any
2023-04-07 19:21:05 +08:00

12 lines
198 B
Go

package sliceUtil
// InSlice 判断value是否在slice中
func InSlice[T comparable](value T, slices []T) bool {
for _, v := range slices {
if value == v {
return true
}
}
return false
}