//判断输入是否包含中文  不管你有没有输入英文,只要包含中文,就返回 true
   public static bool HasChinese(string content)
   {
       //判断是不是中文
       string regexstr = @"[\u4e00-\u9fa5]";
 
       if (Regex.IsMatch(content, regexstr))
       {
           Log("HasChinese");
           return true;
       }
       else
       {
           Log("Has Not Chinese");
           return false;
       }
   }
 
   //判断是不是数字
   public static bool isInterger(string str)
   {
       if (str == "")
       {
           return false;
       }
       else
       {
           foreach (char c in str)
           {
               if (char.IsNumber(c))
               {
                   continue;
               }
               else
               {
                   return false;
               }
           }
       }
       return true;
 
   }
 
   //只允许数字或字母的判断
   public static bool isIntergerOrLetter(string content)
   {
       System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[A-Za-z0-9]+$");
       return reg1.IsMatch(content);
   }

相关文章:

  • 2021-11-17
  • 2021-09-05
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2021-12-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
相关资源
相似解决方案