• 根据字符串拆分字符串


     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 
     6 namespace SINOStockBL
     7 {
     8      public class StrSplitHelp
     9     {
    10         #region 拆分字符串
    11         /// <summary>
    12         /// 根据字符串拆分字符串
    13         /// </summary>
    14         /// <param name="strSource">要拆分的字符串</param>
    15         /// <param name="strSplit">拆分符</param>
    16         /// <returns></returns>
    17         public static string[] StringSplit(string strSource, string strSplit)
    18         {
    19             string[] strtmp = new string[1];
    20             int index = strSource.IndexOf(strSplit, 0);
    21             if (index < 0)
    22             {
    23                 strtmp[0] = strSource;
    24                 return strtmp;
    25             }
    26             else
    27             {
    28                 strtmp[0] = strSource.Substring(0, index);
    29                 return StringSplit(strSource.Substring(index + strSplit.Length), strSplit, strtmp);
    30             }
    31         }
    32         #endregion
    33 
    34         #region 采用递归将字符串分割成数组
    35         /// <summary>
    36         /// 采用递归将字符串分割成数组
    37         /// </summary>
    38         /// <param name="strSource"></param>
    39         /// <param name="strSplit"></param>
    40         /// <param name="attachArray"></param>
    41         /// <returns></returns>
    42         private static string[] StringSplit(string strSource, string strSplit, string[] attachArray)
    43         {
    44             string[] strtmp = new string[attachArray.Length + 1];
    45             attachArray.CopyTo(strtmp, 0);
    46 
    47 
    48             int index = strSource.IndexOf(strSplit, 0);
    49             if (index < 0)
    50             {
    51                 strtmp[attachArray.Length] = strSource;
    52                 return strtmp;
    53             }
    54             else
    55             {
    56                 strtmp[attachArray.Length] = strSource.Substring(0, index);
    57                 return StringSplit(strSource.Substring(index + strSplit.Length), strSplit, strtmp);
    58             }
    59         }
    60         #endregion
    61     }
    62 }
    Android 成长之路
  • 相关阅读:
    字体图标
    css精灵图
    css定位
    浮动的清除
    浮动、版心布局
    css 盒子模型
    css三大特性、行高属性、权重
    JSP实现上传文件(或图片)到MySQL
    MySQL 错误. Packet for query is too large (***> 4194304). You can change......
    使用Servlet3.0提供的API实现文件上传到指定位置
  • 原文地址:https://www.cnblogs.com/liende/p/3240726.html
Copyright © 2020-2023  润新知