mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Adds a function to test that a list contains at least one occurrence of an element
This commit is contained in:
@ -160,3 +160,13 @@ func ReadLines(path string) (lines []string, err error) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
func Contains[T comparable](arr []T, x T) bool {
|
||||
for _, v := range arr {
|
||||
if v == x {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user