RM.Common/DotNetCode/ValidateUtil.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Text;
using System.Text.RegularExpressions;
namespace RM.Common.DotNetCode
{
public class ValidateUtil
{
private static Regex RegNumber = new Regex("^[0-9]+$");
private static Regex RegNumberSign = new Regex("^[+-]?[0-9]+$");
private static Regex RegDecimal = new Regex("^[0-9]+[.]?[0-9]+$");
private static Regex RegDecimalSign = new Regex("^[+-]?[0-9]+[.]?[0-9]+$");
private static Regex RegEmail = new Regex("^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$");
private static Regex RegCHZN = new Regex("[一-龥]");
public static int GetStringLength(string stringValue)
{
return Encoding.Default.GetBytes(stringValue).Length;
}
public static bool IsValidUserName(string userName)
{
int userNameLength = ValidateUtil.GetStringLength(userName);
return userNameLength >= 4 && userNameLength <= 20 && Regex.IsMatch(userName, "^([\\u4e00-\\u9fa5A-Za-z_0-9]{0,})$");
}
public static bool IsValidPassword(string password)
{
return Regex.IsMatch(password, "^[A-Za-z_0-9]{6,16}$");
}
public static bool IsValidInt(string val)
{
return Regex.IsMatch(val, "^[1-9]\\d*\\.?[0]*$");
}
public static bool IsNumber(string inputData)
{
Match i = ValidateUtil.RegNumber.Match(inputData);
return i.Success;
}
public static bool IsNumberSign(string inputData)
{
Match i = ValidateUtil.RegNumberSign.Match(inputData);
return i.Success;
}
public static bool IsDecimal(string inputData)
{
Match i = ValidateUtil.RegDecimal.Match(inputData);
return i.Success;
}
public static bool IsDecimalSign(string inputData)
{
Match i = ValidateUtil.RegDecimalSign.Match(inputData);
return i.Success;
}
public static bool IsHasCHZN(string inputData)
后面还有 148 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
