shop.Tools/ValidataField.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace shop.Tools
{
public class ValidataField
{
public static string OK = "ok";
private static string chineseReg = @"[^\x00-\xff]";
private static string emailReg = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
private static string telReg = @"^[0-9]{3,}-[0-9]{6,8}$";
private static string mobileReg = @"^1[0-9]{10}$";
private static string postcodeReg = @"^\d{6}$";
private static string cardIDReg = @"^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$";
private static string numberReg = @"^\d+$";
public static string ValidataUserName(string userName)
{
int len = GetLength(userName);
if (userName.Trim().Length == 0)
{
return "请输入用户名";
}
if (len < 5 || len > 20)
{
return "用户名长度不够或者超过范围";
}
if (userName.IndexOf('\'') > -1)
{
return "用户名中含有的单引号为非法字符";
}
if (userName.IndexOf('\"') > -1)
{
return "用户名中含有的双引号为非法字符";
}
return OK;
}
public static string ValidataPassword(string password)
{
int len = GetLength(password);
if (len == 0)
{
return "请输入密码";
}
else if (len < 6 || len > 50)
{
return "密码长度不够或超出范围";
}
return OK;
}
public static string ValidataConfirmPassword(string password, string confirPassword)
{
if (confirPassword.Trim().Length == 0)
{
return "请确认密码";
}
else if (password != confirPassword)
{
return "密码前后输入不一致";
后面还有 163 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
