Discard null values from scraper results (#1374)

This commit is contained in:
bnkai
2021-05-16 09:40:54 +03:00
committed by GitHub
parent c73025c86d
commit bc9aa02835
2 changed files with 17 additions and 4 deletions

View File

@@ -69,6 +69,17 @@ func StrUnique(vs []string) []string {
return ret
}
// StrDelete returns the vs string slice with toDel values removed.
func StrDelete(vs []string, toDel string) []string {
var ret []string
for _, v := range vs {
if v != toDel {
ret = append(ret, v)
}
}
return ret
}
// StringSliceToIntSlice converts a slice of strings to a slice of ints.
// Returns an error if any values cannot be parsed.
func StringSliceToIntSlice(ss []string) ([]int, error) {