c_pcode.go 575 B

1234567891011121314151617181920212223242526272829
  1. package clean
  2. import (
  3. "strings"
  4. "unicode/utf8"
  5. )
  6. // 清洗项目编号
  7. func CleanPcode(pcode string, fns []string) string {
  8. if pcode == "无" {
  9. return ""
  10. }
  11. pcode = fieldReg1.ReplaceAllString(pcode, "")
  12. pcode = pcodeReg1.ReplaceAllString(pcode, "")
  13. pcode = pcodeReg2.ReplaceAllString(pcode, "")
  14. if utf8.RuneCountInString(pcode) < 5 {
  15. pcode = ""
  16. }
  17. //校验与附件名字否是一致-舍弃
  18. for _, v := range fns {
  19. if utf8.RuneCountInString(v) >= utf8.RuneCountInString(pcode) {
  20. if strings.Contains(v, pcode) {
  21. return ""
  22. }
  23. }
  24. }
  25. return pcode
  26. }