I want to parse a string xxxxx:yyyyy:zzz.aaa.bbb.cc:dd:ee:ff to a struct in Go, how can I do it with multiple delimiter \':\' and \'.\'.
Edit:
I want to split the
Here is a generic function that will take a string as a set of runes to split on.
func Splitter(s string, splits string) []string {
m := make(map[rune]int)
for _, r := range splits {
m[r] = 1
}
splitter := func(r rune) bool {
return m[r] == 1
}
return strings.FieldsFunc(s, splitter)
}
func TestSplit() {
words := Splitter("orange apple-banana", " -")
}