forked from Ivasoft/traefik
IP Whitelists for Frontend (with Docker- & Kubernetes-Provider Support)
This commit is contained in:
committed by
Ludovic Fernandez
parent
55f610422a
commit
5f0b215e90
19
provider/string_util.go
Normal file
19
provider/string_util.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package provider
|
||||
|
||||
import "strings"
|
||||
|
||||
// SplitAndTrimString splits separatedString at the comma character and trims each
|
||||
// piece, filtering out empty pieces. Returns the list of pieces or nil if the input
|
||||
// did not contain a non-empty piece.
|
||||
func SplitAndTrimString(separatedString string) []string {
|
||||
listOfStrings := strings.Split(separatedString, ",")
|
||||
var trimmedListOfStrings []string
|
||||
for _, s := range listOfStrings {
|
||||
s = strings.TrimSpace(s)
|
||||
if len(s) > 0 {
|
||||
trimmedListOfStrings = append(trimmedListOfStrings, s)
|
||||
}
|
||||
}
|
||||
|
||||
return trimmedListOfStrings
|
||||
}
|
||||
Reference in New Issue
Block a user