Conris.Utility/RegCommon.cs

(开头部分) 2KB

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

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

namespace Conris.Utility
{
    public static class RegCommon
    {
        public static bool IsReg(this string InPut, string strReg)
        {
            if (string.IsNullOrEmpty(InPut) || string.IsNullOrEmpty(strReg))
                return false;
            Regex regex = new Regex(strReg, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            Match match = regex.Match(InPut);
            return match.Success;
        }
        public static string GetStrRegSingle(this string InPut, string strReg)
        {
            if (string.IsNullOrEmpty(InPut) || string.IsNullOrEmpty(strReg))
                return "";
            Regex regex = new Regex(strReg, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            string value = "";
            Match match = regex.Match(InPut);
            if (match.Success)
            {
                return match.Groups[1].Value;
            }
            return value;
        }
        public static string GetStrRegByName(this string InPut, string strReg, string Name)
        {
            if (string.IsNullOrEmpty(InPut) || string.IsNullOrEmpty(strReg))
                return "";
            Regex regex = new Regex(strReg, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            string value = "";
            Match match = regex.Match(InPut);
            if (match.Success)
            {
                return match.Groups[Name].Value;
            }
            return value;
        }
        public static int GetIntRegSingle(this string InPut, string strReg)
        {
            int value = 0;
            string tempValue = GetStrRegSingle(InPut, strReg);
            int.TryParse(tempValue, out value);
            return value;
        }
        public static List<string> GetContentList(this string ViewContent, string strReg)
        {
            List<string> ContentList = new List<string>();
            MatchCollection matchs = Regex.Matches(ViewContent, strReg, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            if (matchs.Count > 0)
            {
                foreach (Match match in matchs)
                {
                    GroupCollection group = match.Groups;
后面还有 9 行代码,购买后查看完整代码

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

AI 解读

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

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