Config Array Syntax (#8204)
* refactor util encryption library so it doesn't have to import log * add util.SplitString to handle space and/or comma-separated config lines * go fmt
This commit is contained in:
committed by
Torkel Ödegaard
parent
d085aaad41
commit
b489e93d94
@@ -1,5 +1,9 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func StringsFallback2(val1 string, val2 string) string {
|
||||
return stringsFallback(val1, val2)
|
||||
}
|
||||
@@ -16,3 +20,11 @@ func stringsFallback(vals ...string) string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func SplitString(str string) []string {
|
||||
if len(str) == 0 {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
return regexp.MustCompile("[, ]+").Split(str, -1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user