add support for DHGEX

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-11-17 18:15:53 +01:00
parent 67de4c9c07
commit a22282f275
9 changed files with 115 additions and 39 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 {