110,545
社区成员
发帖
与我相关
我的任务
分享
//上面写错了,更正下方法
public bool getFlat(string noKnow)
{
bool falt=false;
byte[] bArry=System.Text.encoding.Unicode.getbytes(noKnow);
if( bArry.Length=2)
{
if(bArry[1]!=0) falt=true;
}
return falt;
}
//方法很笨,很简单,不要见笑啊
public bool getFlat(string noKnow)
{
byte[] bArry=System.Text.encoding.Unicode.getbytes(noKnow);
if( bArry.Length=2)
{
if(bArry[1]!=0) return true; else return false; //当然noKnow有可能是汉字,因为汉字也是两个字节,但是汉字我已经用其他正则方法判断了,所以noKnow是不会有汉字传入的,有两个字节的就为 中文字符。方法笨,并且可能只适用我自己的应用。
}
}
//枚举出来就可以了
Regex regex = new Regex(@"[,。;?~!:‘“”’【】()]");
if (r.IsMatch(",。"))
{
Console.WriteLine(" is match ");
}