zoukankan      html  css  js  c++  java
  • .net工具类——分割字符串

            #region 分割字符串
    
            /// <summary>
            /// 分割字符串
            /// </summary>
            public static string[] SplitString(string strContent, string strSplit)
            {
                if (!string.IsNullOrEmpty(strContent))
                {
                    if (strContent.IndexOf(strSplit) < 0)
                        return new string[] { strContent };
    
                    return Regex.Split(strContent, Regex.Escape(strSplit), RegexOptions.IgnoreCase);
                }
                else
                    return new string[0] { };
            }
    
            /// <summary>
            /// 分割字符串
            /// </summary>
            /// <returns></returns>
            public static string[] SplitString(string strContent, string strSplit, int count)
            {
                string[] result = new string[count];
                string[] splited = SplitString(strContent, strSplit);
    
                for (int i = 0; i < count; i++)
                {
                    if (i < splited.Length)
                        result[i] = splited[i];
                    else
                        result[i] = string.Empty;
                }
    
                return result;
            }
    
            #endregion 分割字符串
  • 相关阅读:
    Python正则表达式
    机器学习--------SVM
    tensor内部结构
    Tensor类型
    Tensor索引操作
    常用的Tensor操作
    Tensor基本操作
    神经网络
    Autograd:自动微分
    nginx之fastcgi配置
  • 原文地址:https://www.cnblogs.com/amusement1992/p/13496184.html
Copyright © 2011-2022 走看看