DBUtility/Tools.cs

(开头部分) 6KB

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

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

namespace DBUtility
{
    public class Tools
    {
        /// <summary>
        /// 产生随机字符串(数字、小写/大写字母)
        /// </summary>
        /// <param name="length">字符串长度</param>
        /// <returns>随机字符串</returns>
        public static string GetRandomChar(int length)
        {
            char[] chr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
        'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
        'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};

            Random random = new Random();
            StringBuilder buffer = new StringBuilder();
            for (int i = 0; i < length; i++)
            {
                buffer.Append(chr[random.Next(62)]);
            }
            return buffer.ToString();
        }

        /// <summary>
        /// 产生随机字符串(数字、小写/大写字母)
        /// </summary>
        /// <param name="length">字符串长度</param>
        /// <returns>随机字符串</returns>
        public static string GetRandomNumber(int length)
        {
            char[] chr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

            Random random = new Random();
            StringBuilder buffer = new StringBuilder();
            for (int i = 0; i < length; i++)
            {
                buffer.Append(chr[random.Next(10)]);
            }
            return buffer.ToString();
        }

        /// 在指定的字符串列表CnStr中检索符合拼音索引字符串

        /// </summary>

        /// <param name="CnStr">汉字字符串</param>

        /// <returns>相对应的汉语拼音首字母串</returns>

        public static string GetSpellCode(string CnStr)
        {

            string strTemp = "";

后面还有 198 行代码,购买后查看完整代码

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

AI 解读

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

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