字符串转Unicode码

var str = '中';

var charCode = str.charCodeAt(0);

console.log(charCode); // => 20013;

str.charCodeAt(0).toString(16);//=>"4e2d"

 

posted on 2017-07-06 17:04  程序猿-alvin  阅读(206)  评论(0编辑  收藏  举报

导航