The-Golang-Standard-Library-by-Example
The-Golang-Standard-Library-by-Example copied to clipboard
unicode章节建议增加汉字range
在unicode package中定义了各种字符的range,比如unicode.Han则代表了所有中文字符的range,还有个方法提供判断一个字符是不是落在某个区间。具体可以参考下面的一个示例。
package main
import (
"unicode"
"fmt"
)
func main() {
fmt.Println(unicode.In('C', unicode.Han))
fmt.Println(unicode.In('具', unicode.Han))
}
output: false true