func Split(r rune) bool {
return r == '+' || r == '-'||r == '*'||r == '/'||r == '+'||r == '('||r == ')'||r == '%'||r=='['||r==']'||r=='^'
}
//字符切分
func Split_string(s string) []string {
a := strings.FieldsFunc(s, Split)
return a
}
func Split(r rune) bool {
return r == '+' || r == '-'||r == '*'||r == '/'||r == '+'||r == '('||r == ')'||r == '%'||r=='['||r==']'||r=='^'
}
//字符切分
func Split_string(s string) []string {
a := strings.FieldsFunc(s, Split)
return a
}
本文标题:Go语言:多种分隔符分割字符串
本文链接:https://www.haomeiwen.com/subject/lvhdiktx.html
网友评论