将unicode的字符串转程unicode
function unicode2utf16(codePoint) {
if (typeof codePoint === ‘string’) {
codePoint = parseInt(codePoint, 16);
}
if (codePoint < 0xdbff) {
return String.fromCharCode(codePoint);
} else {
var high = Math.floor((codePoint - 0x10000) / 0x400) + 0xd800;
var low = (codePoint - 0x10000) % 0x400 + 0xdc00;
return String.fromCharCode(high, low);
}
}
function delImageTail(str){
var reg = /.png$/;
return str.replace(reg,”);
}
unicode转码
最新推荐文章于 2024-06-29 02:57:51 发布