英文字母对应的Unicode编码
生活随笔
收集整理的這篇文章主要介紹了
英文字母对应的Unicode编码
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
A~Z :65~90
a~z :97~122
0~9 : 48~57
如果想要知道字符串中的值是否是小寫英文字符,不使用工具包的一種方法就是使用Unicode編碼值,舉例:
package mainimport ("fmt" )func main() {// str := "helloworld" //返回str is all lower charstr := "hello4world" //返回str is not all lower charfor _, s := range str{if !(s > 96 && s < 123){fmt.Println("str is not all lower char")return}}fmt.Println("str is all lower char") }當(dāng)然還有更簡單的一種方法:
package mainimport ("fmt" )func main() {str := "helloworld" //返回str is all lower char// str := "hello4world" //返回str is not all lower charfor _, s := range str{if !('a' <= s && s <= 'z'){fmt.Println("str is not all lower char")return}}fmt.Println("str is all lower char") }?
轉(zhuǎn)載于:https://www.cnblogs.com/wanghui-garcia/p/10568924.html
總結(jié)
以上是生活随笔為你收集整理的英文字母对应的Unicode编码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Robotics 机器人运动学 DH参数
- 下一篇: 学籍管理系统mysql实训报告_学生学籍