misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2018-03-26 13:17:44 +02:00
commit 64af0c4290
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
2 changed files with 9 additions and 7 deletions

View file

@ -41,15 +41,20 @@ func UniqueInts(a []int, sorted bool) []int {
return uniq
}
func CommaSplit(csv string) []string {
func SepSplit(sv string, sep string) []string {
filtered := make([]string, 0)
for _, part := range strings.Split(csv, ",") {
for _, part := range strings.Split(sv, sep) {
part = Trim(part)
if part != "" {
filtered = append(filtered, part)
}
}
return filtered
}
func CommaSplit(csv string) []string {
return SepSplit(csv, ",")
}
func ExecSilent(executable string, args []string) (string, error) {