package main
import (
"fmt"
"unicode/utf8"
)
func main() {
count := utf8.RuneCountInString("㕎檕獶栲")
fmt.Print(count) // 4
}
package main
import (
"fmt"
"unicode/utf8"
)
func main() {
count := utf8.RuneCountInString("㕎檕獶栲")
fmt.Print(count) // 4
}
本文标题:golang 计算字符串长度(包含汉字)
本文链接:https://www.haomeiwen.com/subject/fbdliftx.html
网友评论