package tool import ( "regexp" "strings" "unicode/utf8" ) func CheckChineseNumber(s string) bool { regx := regexp.MustCompile("(.*)([一|二|两|三|四|五|六|七|八|九|十|百|千|万|亿]+)(.*)") return regx.MatchString(s) } func ChineseNumberToLowercaseLength(s string) int { st := GetStringUtf8Length(s) regx := regexp.MustCompile("([一|二|两|三|四|五|六|七|八|九|十|百|千|万|亿]+)(.*)") s = regx.ReplaceAllString(s , "$1") if s == "" || !IsChineseNumber(s) { return st } rst := GetStringUtf8Length(s) cha_t := 0 if st > rst { cha_t = st - rst } s = strings.TrimSpace(s) zhTexts := strings.Split(s , "") zhTextsLens := len(zhTexts) numberPosi := true maxBaseNumber := 1 if s == "十" { maxBaseNumber = 2 } else { for i:=0; i 6 { return false } regx := regexp.MustCompile(`^(\\|\{|\}|\[|\]|(|)|\(|\)|\*|/|~|<|>|_|\-|\+|=|&|%|\$|@|#|—|」|「|!|,|。|。|‍|、|?|;|:|‘|’|”|“|"|'|,|\.|\?|;|:|!|\s)+$`) if regx.Match([]byte(s)) { return true } else { return false } }