JavaScript中字符串与Unicode编码的互相转换
2018-01-23 本文已影响0人
未来与传说
-
字符串转unicode码
"中".charCodeAt(0); // 20013 -
unicode码转字符中
String.fromCharCode(20013) // 中 -
将unicode码转16进制
"中".charCodeAt(0).toString(16) // 4e2d
字符串转unicode码
"中".charCodeAt(0); // 20013
unicode码转字符中
String.fromCharCode(20013) // 中
将unicode码转16进制
"中".charCodeAt(0).toString(16) // 4e2d