第一种办法:( by TKF 大神)
var s = "app下载量为式一肖"
import string.xml
console.log(string.xml.ncr(s))
console.pause(true);
第二种办法:
import web.layout;
var wb = web.layout( mainForm, 0xFFFF);
wb.html="<div id='mydiv'>a下载肖</div>";
mainForm.button.oncommand=function(id,event){
win.msgbox( wb.$1('#mydiv').innerHTML);
}
mainForm.show();
return win.loopMessage();
第三种方法:
var s = "app下载量为式一肖"
entitiesToString = function(entities){
return string.replace(entities,"<@&#@>(\d+);",function(p1){
var num = tonumber(p1)
var char;
if(num<256){
char = string.pack(num)
}else{
char = ustring.fromCharCode(num)
char = string.fromUnicode(char)
}
return char
}
)
}
var s2 = entitiesToString(s)
全都好使。。想用哪个,自己看。。。。拿走不谢,留个言夸一下就好了。
另外,还有 Entity编码的函数。。。主要用于灰词转义(好不好使不一定)
stringToEntities = function(s){
var o = string.split(s, '')
var ret = {}
for(i=1;#o;1){
o[i] = string.fromto(o[i],,1200)
var char = {string.unpack(o[i])}
var v = char[2] * 256 + char[1]
ret[i] = '&#' ++ tostring(v) ++ ';'
}
return string.join(ret, '')
}
发表评论