package clean import ( "strings" "unicode/utf8" ) // 清洗项目编号 func CleanPcode(pcode string, fns []string) string { if pcode == "无" { return "" } pcode = fieldReg1.ReplaceAllString(pcode, "") pcode = pcodeReg1.ReplaceAllString(pcode, "") pcode = pcodeReg2.ReplaceAllString(pcode, "") if utf8.RuneCountInString(pcode) < 5 { pcode = "" } //校验与附件名字否是一致-舍弃 for _, v := range fns { if utf8.RuneCountInString(v) >= utf8.RuneCountInString(pcode) { if strings.Contains(v, pcode) { return "" } } } return pcode }