go strconv.IsPrint()方法

strconv.IsPrint()方法

语法

func IsPrint(r rune) bool

go源码中对IsPrint()方法的介绍:

IsPrint reports whether the rune is defined as printable by Go, with the same definition as unicode.IsPrint: letters, numbers, punctuation, symbols and ASCII space.

go语言中的strconv.IsPrint()方法可以用于判断参数指定的r是否是go当中的printable可打印的,参数r是rune类型,可以是Unicode编码(个人理解,仅供参考)的字母(广义)、数字、标点、符号、ASCII空格等。


参数

参数描述
rrune类型值

返回值

go bool类型值,如果r是可打印的,则返回true,否则返回false。


strings.Count()方法实例代码

func main() {
	var t1 bool = strconv.IsPrint(31528)
	fmt.Println(t1)
	t2 := strconv.IsPrint(6)
	fmt.Println(t2)
}
//命令行输入运行go文件的命令,比如:go run test.go,得到输出:
true
false

全栈后端 / go语法 :













Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.