golang中string长度

       golang中计算string长度用len函数,但是len函数返回的是字符串的 byte 数量

       如果要得到字符串的字符数,可使用 "unicode/utf8" 包中的 RuneCountInString(str string) (n int)

       因为string中不一定都是ASCII

猜你喜欢

转载自blog.csdn.net/ma2595162349/article/details/109016720