Common/Checks.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Common
{
    using System.Web.Script.Serialization;
    public class Checks
    {
        #region 检查是否是数字 +bool IsInt(string str)
        /// <summary>
        /// 检查是否是数字
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool IsInt(string str)
        {
            int d = 0;
            return int.TryParse(str, out d);
        }
        #endregion

        #region 用正则表达式检查是否是数字 + bool IsNum(string str)
        /// <summary>
        /// 用正则表达式检查是否是数字
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool IsNum(string str)
        {
            System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"^\d+$");
            return reg.IsMatch(str);
        }
        #endregion

        #region 读取文本数据 +string GetFileTex(string path)
        /// <summary>
        /// 读取文本数据
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string GetFileTex(string path)
        {
            return System.IO.File.ReadAllText(path);
        }
        #endregion

        #region 获取模版页面的物理路径 +string GetPhyPath(string path)
        /// <summary>
        /// 获取模版页面的物理路径
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string GetPhyPath(string path)
        {
            return HttpContext.Current.Server.MapPath(path);
        }
        #endregion

后面还有 34 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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