[C#] 验证字符串是否是中文 →→→→→进入此内容的聊天室

来自 , 2019-05-02, 写在 C#, 查看 168 次.
URL http://www.code666.cn/view/d7619beb
  1. /// 中文
  2. public static bool IsChinese ( string source )
  3. {
  4.         return Regex.IsMatch ( source, @"^[\u4e00-\u9fa5]+$", RegexOptions.IgnoreCase );
  5. }
  6. public static bool hasChinese ( string source )
  7. {
  8.         return Regex.IsMatch ( source, @"[\u4e00-\u9fa5]+", RegexOptions.IgnoreCase );
  9. }
  10.  

回复 "验证字符串是否是中文"

这儿你可以回复上面这条便签

captcha