拆分字符串,将一个string拆分成一个[]string的切片,类似于PHP的explode()
prefixemail := strings.Split("xhstytome@163.com", "@")
fmt.Println(prefixemail) // [xhstytome 163.com]
拼接字符串,将一个[]string的切片通过分隔符,拼接成一个字符串,类似于PHP的implode()
s := []string{"hello", "word", "ED"}
fmt.Println(strings.Join(s, "-")) // hello-word-ED
原文:https://www.cnblogs.com/lz0925/p/11903861.html