按长度截取字符串

 

截取字符串

 public static String[] getstr(string strs, int len)
        {
            double i = strs.Length;
            string[] myarray = new string[int.Parse(Math.Ceiling(i / len).ToString())];
            for (int j = 0; j < myarray.Length; j++)
            {
                len = len <= strs.Length ? len : strs.Length;
                myarray[j] = strs.Substring(0, len);
                strs = strs.Substring(len, strs.Length - len);
            }
            return myarray;
        }
View Code

原博主地址:https://blog.csdn.net/roguemaster/article/details/17756823

posted @ 2020-05-22 15:14  见往  阅读(78)  评论(0)    收藏  举报