Example #1
0
        /// <summary>
        /// 字符串验证
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnString_Click(object sender, EventArgs e)
        {
            string strValue  = this.cboxString.SelectedItem as string;
            bool   checkFlag = false;

            switch (strValue)
            {
            case "用户密码":
                checkFlag = ValidHelper.EngIsPassword(this.txtString.Text);
                break;

            case "用户密码2":
                checkFlag = ValidHelper.EngIsPasswords(this.txtString.Text);
                break;

            case "注册帐号":
                checkFlag = ValidHelper.EngIsRegister(this.txtString.Text);
                break;

            case "26个字母":
                checkFlag = ValidHelper.EngIsEnglish(this.txtString.Text);
                break;

            case "大写字母":
                checkFlag = ValidHelper.EngIsUppercase(this.txtString.Text);
                break;

            case "小写字母":
                checkFlag = ValidHelper.EngIsLowercase(this.txtString.Text);
                break;

            case "字母数字":
                checkFlag = ValidHelper.EngIsEngAndNum(this.txtString.Text);
                break;

            case "英头数字":
                checkFlag = ValidHelper.EngIsEngAndNums(this.txtString.Text);
                break;

            case "字数下线":
                checkFlag = ValidHelper.EngIsEngAndNumOrUnderline(this.txtString.Text);
                break;

            default:
                break;
            }
            this.lblResultString.Text = checkFlag.ToString();
        }