Split String

Splits a string into substrings separated by a given separator substring.

Examples Filter
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 == '.'
}
Last Run  :
[xxxxx yyyyy zzz aaa bbb cc dd ee ff]
package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Printf("%q\n", strings.Split("a,b,c", ","))
	fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "an"))
	fmt.Printf("%q\n", strings.Split(" xyz ", ""))
	fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins"))
}
Last Run  :
["a" "b" "c"]
["a m" " a pl" " a c" "al p" "ama"]
[" " "x" "y" "z" " "]
[""]