gstr_length.go 408 B

1234567891011121314
  1. // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
  2. //
  3. // This Source Code Form is subject to the terms of the MIT License.
  4. // If a copy of the MIT was not distributed with this file,
  5. // You can obtain one at https://github.com/gogf/gf.
  6. package gstr
  7. import "unicode/utf8"
  8. // LenRune returns string length of unicode.
  9. func LenRune(str string) int {
  10. return utf8.RuneCountInString(str)
  11. }