CityMgr/ValidateHelperr.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using RhData;

namespace CityMgr
{
    /// <summary>
    /// 有效性验证工具类
    /// </summary>
    [Serializable]
    public static class ValidateHelperr
    {
        /// <summary>
        /// 验证编码是否合法
        /// </summary>
        /// <param name="str">要验证的字符串</param>
        /// <returns>是否合法</returns>
        public static bool CheckCode(string str)
        {
            const int CODE_MAX_LENGTH = 20;

            if (str.Length <= 0 || str.Length > CODE_MAX_LENGTH)
            {
                return false;
            }
            else
            {
                return !Regex.IsMatch(str, @"\W+");
            }
        }

        /// <summary>
        /// 检测名称是否合法
        /// </summary>
        /// <param name="str">要检查的字符串</param>
        /// <returns>是否合法</returns>
        public static bool CheckName(string str)
        {
            const int NAME_MAX_LENGTH = 100;

            if (str.Length <= 0 || str.Length > NAME_MAX_LENGTH)
            {
                return false;
            }
            else
            {
                return !Regex.IsMatch(str, @"[';]+");
            }
        }

        /// <summary>
        /// 检测Email地址是否合法
        /// </summary>
        /// <param name="str">Email地址</param>
        /// <returns>是否合法</returns>
        public static bool CheckEmail(string str)
        {
后面还有 36 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。