///Full-width spaces are 12288, half-width spaces are 32
///The corresponding relationship between half-width (33-126) and full-width (65281-65374) of other characters is: the difference is 65248
//Half-width to full-width function
function ToDBC(txtstring)
{
var tmp = "";
for(var i=0;i{
if(txtstring.charCodeAt(i)==32)
{
tmp= tmp String.fromCharCode(12288);
}
if(txtstring.charCodeAt(i)<127)
{
tmp=tmp String.fromCharCode(txtstring.charCodeAt(i) 65248);
}
}
return tmp;
}
//Convert full-width to half-width function
function ToCDB(str)
{
var tmp = " ";
for(var i=0;i{
if(str.charCodeAt(i)>65248&&str.charCodeAt(i)<65375)
{
tmp = String.fromCharCode(str.charCodeAt(i)-65248);
}
else
{
tmp = String.fromCharCode(str.charCodeAt(i));
}
}
return tmp
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn