has.go 307 B

12345678910111213141516
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package util
  4. import "unicode"
  5. // HasChinese 是否有汉字
  6. func HasChinese(s string) bool {
  7. for _, v := range s {
  8. if unicode.Is(unicode.Scripts["Han"], v) {
  9. return true
  10. }
  11. }
  12. return false
  13. }