按字符统计数量(包括中文)

package main

import "UTF-8"

func main(){
  // 统计Uncode字符数量
  fmt.Println(utf8.RuneCountInString("忍者")) // 2
  fmt.Println(utf8.RuneCountInString("聋人出鞘,fight!") // 11
}
posted @ 2022-03-03 15:35  我在路上回头看  阅读(78)  评论(0)    收藏  举报