package utils import "regexp" func Rstrip(str string) string { if str == "" { return "" } //匹配一个或多个空白符的正则表达式 reg := regexp.MustCompile("\\0+$") return reg.ReplaceAllString(str, "") }