Common/RegExp.cs

(开头部分) 8KB

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

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

/// <summary>
/// 正则表达式
/// </summary>
public class RegExp
{


    #region 判断是否为Unicode码 public static bool IsUnicode(string s)
    /// <summary>
    /// 判断是否为Unicode码
    /// </summary>
    public static bool IsUnicode(string s)
    {
        string pattern = @"^[\u4E00-\u9FA5\uE815-\uFA29]+$";
        return Regex.IsMatch(s, pattern);
    }
    #endregion

    #region 得到二个正整数的分数值 	public static string[] GetPercence(int a, int b)
    /// <summary>
    /// 得到二个正整数的分数值
    /// </summary>
    /// <param name="a"></param>
    /// <param name="b"></param>
    /// <returns></returns>
    public static string[] GetPercence(int a, int b)
    {
        while (true)
        {
            if (0 == a % 2 && 0 == b % 2)
            {
                a = a / 2;
                b = b / 2;
            }
            else if (0 == a % 3 && 0 == b % 3)
            {
                a = a / 3;
                b = b / 3;
            }
            else if (0 == a % 5 && 0 == b % 5)
            {
                a = a / 5;
                b = b / 5;
            }
            else if (0 == a % 7 && 0 == b % 7)
            {
                a = a / 7;
                b = b / 7;
            }
            else
            {
                break;
            }
        }
        return new string[2] { a.ToString(), b.ToString() };
后面还有 226 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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