Full angle Half angle conversion
Str: a special converted String
Flag:false: Full angle turn half angle
function Dc2sc (Str,flag)
{
var i;
var result= ';
str = str.replace (/"/g," ""). Replace (/"/g," ""). Replace (/'/g, "'). Replace (/'/g," ' "). Replace (/,/g,", "). Replace (/. /g, ".");
for (i=0;i<str.length;i++)
{
Str1=str.charcodeat (i);
if (Str1<125&&!flag)
Result+=string.fromcharcode (Str.charcodeat (i));
else if (Str.substr (i,1). Match (/[u4e00-u9fa5]+?/) &&!flag)
result = Str.substr (i,1);
Else
Result+=string.fromcharcode (Str.charcodeat (i)-65248);
}
return result;
}
Detect if you want to enter English or digital in a half-width state
function Issinglechar (str) {
if (str = = "") return true;
var kigouarray = new Array ();
kigouarray= Str.match (New RegExp (/[^0-9A-ZA-Z@]/GM));
if (Kigouarray = = null) {
return true;
} else {
return false;
// }
for (var i = 0;i < str.length;i++)
{
Strcode = Str.charcodeat (i);
if (Strcode > 65248| | Strcode = 12288)
{
return false;
}
}
return true;
}