标签:arc 编码 cti i++ 获取 页面 toc turn var
根据Unicode编码,全角空格为12288,半角空格为32 ;
其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248
//全角转换为半角函数
function ToCDB(str) {
var tmp = "";
for(var i=0;i<str.length;i++) {
var code = str.charCodeAt(i);//获取当前字符的Unicode编码
if(code>=65281 && code<=65373) {
tmp += String.fromCharCode(str.charCodeAt(i)-65248);
} else {
tmp += String.fromCharCode(str.charCodeAt(i));
}
}
return tmp
}
标签:arc 编码 cti i++ 获取 页面 toc turn var
原文地址:http://www.cnblogs.com/drubber/p/6006067.html