Swift 常用操作
2020-07-28 本文已影响0人
NapoleonY
- Charcter 与 Int 互转
let num = strArray[index].asciiValue! - Character("0").asciiValue!
let char = Character(UnicodeScalar(num))
- 大、小写字母转为小写字母
// " " 空格的十进制为32,二进制为 0010 0000
"a" | " " = "a"
"A" | " " = "a"
// "_" 的十进制为95,二进制为0101 1111
"b" & "_" = "B"
"B" & "_" = "B"