文章目录
GoLang之标准库unicode包
本文基于Windos系统上Go SDK v1.8进行讲解
1.IsLetter函数




2.IsLower函数

3.IsUpper函数

4.ToLower函数

5.ToUpper函数

6.IsNumber函数


7.IsDigit函数


8.IsPunct函数
IsPunct报告一个字符是否是unicode标点字符
func IsPunct(r rune) bool
func main() {
fmt.Println(unicode.IsPunct(',')) //true
fmt.Println(unicode.IsPunct('+')) //false
fmt.Println(unicode.IsPunct('a')) //false
fmt.Println(unicode.IsPunct(' ')) //false
fmt.Println(unicode.IsPunct('\'')) //true
fmt.Println(unicode.IsPunct('_')) //true
fmt.Println(unicode.IsPunct('-')) //true
}
本文详细介绍Go语言中标准库unicode包的常用函数,如IsLetter判断字符是否为字母,IsPunct检测字符是否为标点,以及ToLower和ToUpper转换大小写。通过实例演示如何运用这些功能处理Unicode字符。
277

被折叠的 条评论
为什么被折叠?



