Split String with Multiple Delimiters in Go

Posted by yhuang
Public (Editable by Users)
Go
Edit
package main

import (
	"fmt"
	"strings"
)

func main() {
	input := `xxxxx:yyyyy:zzz.aaa.bbb.cc:dd:ee:ff`
	a := strings.FieldsFunc(input, Split)
	fmt.Println(a)
}
func Split(r rune) bool {
	return r == ':' || r == '.'
}