using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace WWBClassLib.Tools
{
public static class Validate
{
// Fields
private static Regex RegCHZN = new Regex("^[/u4e00-/u9fa5]");
private static Regex RegDecimal = new Regex("^[0-9]+[.]?[0-9]+___FCKpd___0quot;);
private static Regex RegDecimalSign = new Regex("^[+-]?[0-9]+[.]?[0-9]+___FCKpd___0quot;);
private static Regex RegEmail = new Regex(@"^[/w-]+@[/w-]+/.(com|net|org|edu|mil|tv|biz|info)___FCKpd___0quot;);
private static Regex RegNumber = new Regex("^[0-9]+___FCKpd___0quot;);
private static Regex RegNumberSign = new Regex("^[+-]?[0-9]+___FCKpd___0quot;);
// Methods
public static bool IsChinese(string str_chinese)
{
return Regex.IsMatch(str_chinese, @"^[/u4e00-/u9fa5],{0,}___FCKpd___0quot;);
}
public static bool IsDecimal(string inputData)
{
return RegDecimal.Match(inputData).Success;
}
public static bool IsDecimalSign(string inputData)
{
return RegDecimalSign.Match(inputData).Success;
}
public static bool IsInteger(string inputData)
{
return RegNumber.Match(inputData).Success;
}
public static bool IsIntegerSign(string inputData)
{
return RegNumberSign.Match(inputData).Success;
}
public static bool IsLetter(string str_Letter)
{
return Regex.IsMatch(str_Letter, "^[A-Za-z]+___FCKpd___0quot;);
}
public static bool IsLowChar(string str_UpChar)
{
return Regex.IsMatch(str_UpChar, "^[a-z]+___FCKpd___0quot;);
}
public static bool IsUpChar(string str_UpChar)
{
return Regex.IsMatch(str_UpChar, "^[A-Z]+___FCKpd___0quot;);
}
public static bool IsValidEmail(string strIn)
{
return Regex.IsMatch(strIn, @"^([/w-/.]+)@((/[[0-9]{1,3}/.[0-9]{1,3}/.[0-9]{1,3}/.)|(([/w-]+/.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(/]?)___FCKpd___0quot;);
}
public static bool IsValidTel(string strIn)
{
return Regex.IsMatch(strIn, @"(/d+-)?(/d{4}-?/d{7}|/d{3}-?/d{8}|^/d{7,8})(-/d+)?");
}
}
}
常用输入项目验证类
最新推荐文章于 2023-03-15 20:00:50 发布