常用输入项目验证类

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+)?");

        }

    }



    

}

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值