set version to 2.4.2

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-11-25 15:06:12 +01:00
parent 9e7e89d69e
commit b989cdabe5
15 changed files with 103 additions and 19 deletions

View File

@@ -125,6 +125,18 @@ func Contains[T comparable](elems []T, v T) bool {
return false
}
// Remove removes an element from a string slice and
// returns the modified slice
func Remove(elems []string, val string) []string {
for idx, v := range elems {
if v == val {
elems[idx] = elems[len(elems)-1]
return elems[:len(elems)-1]
}
}
return elems
}
// IsStringPrefixInSlice searches a string prefix in a slice and returns true
// if a matching prefix is found
func IsStringPrefixInSlice(obj string, list []string) bool {