david2tdw / blog

学习记录
1 stars 1 forks source link

[编码] Unicode和ASCII转换 #83

Open david2tdw opened 5 years ago

david2tdw commented 5 years ago

ASCII 转换为Unicode: String.fromCharCode(i)

String.fromCharCode(65)
"A"
String.fromCharCode(122)
"z"

Unicode转换为ASCII: stringObject.charCodeAt(index)

'A'.charCodeAt(0)
65
'Z'.charCodeAt(0)
90
'a'.charCodeAt(0)
97
'z'.charCodeAt(0)
122

TIM截图20190710113620

david2tdw commented 5 years ago
ASCII 转Unicode 表示方法:
: -> :

a的16进制ASCII 表示方法:
a -> \u0061

中文转Unicode:
啊 -> \u554a
ASCII 转Unicode:
啊 -> 啊

unicode 字符百科

image