C#
public bool IsCharacter(string strInput)
{
try
{
char c=char.Parse(strInput);
if(c>0x7f)
{
//就一般是汉字..
return true;
}
else
{
return false;
}
}
catch
{
return false;
}
}
BLOCKED SCRIPT
function StrLen(str) { return str.replace(/[^\x00-\xff]/g,"**").length;//-str.length; }
function test()
{
var a="你死啦";
if(StrLen(a)-a.Length>0)
{
alert("有汉字啊!");
}else
{
alert("无汉字");
}
}