⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 util.cs

📁 一个比较简单的
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;

namespace AssetsSystem.Inc
{
    class Util
    {
        public static bool haveText(string str)
        {

            if (str == null || string.IsNullOrEmpty(str.Trim()))
            {
                return false;
            }
            return true;
            
        }

        public static bool isnumstr(String num)
        {
            if (!Util.haveText(num))
                return false;
            if (num.Length > 0)
            {
                if (num[0] == '-')
                {
                    num = num.Substring(1, num.Length);
                }
                String number = "0123456789";
                for (int i = 0; i < num.Length; i++)
                {
                    if (number.IndexOf(num[i]) == -1)
                    {
                        return false;
                    }
                }
                return true;
            }
            else
            {
                return false;
            }
        }

        public static string Unhtmlcode(string str)
        {
            string newstr = "";
            if (str == null)
                return "";
            if (str.Length < 1)
                return "";
            newstr = str.Trim();
            newstr = newstr.Replace("&amp;", "&");
            newstr = newstr.Replace("&quot;", "\"");
            newstr = newstr.Replace("&nbsp;", " ");
            newstr = newstr.Replace("&lt;", "<");
            newstr = newstr.Replace("&gt;", ">");
            newstr = newstr.Replace("&#039;", "\'");
            newstr = newstr.Replace("<br/>", "\r\n");
            return newstr;
        }
        public static string HTMLcode(string TXTcode)
        {
            string newstr = "";
            if (TXTcode == null)
                return "";
            newstr = TXTcode.Trim();
            newstr = newstr.Replace("&", "&amp;");
            newstr = newstr.Replace("\"", "&quot;");
            newstr = newstr.Replace(" ", "&nbsp;");
            newstr = newstr.Replace("<", "&lt;");
            newstr = newstr.Replace(">", "&gt;");
            newstr = newstr.Replace("\'", "&#039;");
            newstr = newstr.Replace("\r\n", "<br/>");
            newstr = newstr.Replace("\n", "<br/>");
            newstr = newstr.Replace("\r", "<br/>");
            return newstr;

        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -