参考地址:
参考代码:
1
2
/* *unicode编码和字符相互转化 */ "要".charCodeAt() == 35201; //true,35201为10进制值 String.fromCharCode(35201) == "要"; //true,35201为10进制值 "\u89" + "81" == "要"; //false,值为"u8981",是由于"\u"会转义成"u" //从unicode编码到字符的方法 eval("(\"\u89" + "81\")") == "要"; //true,8981为16进制值
结论:
var ins = String.fromCharCode(160); ins = new RegExp(ins, "g"); s = s.replace(ins, "");
完