c# 字符串递归截取

   private void button1_Click_1(object sender, EventArgs e)
        {
            string ex = neirong.Text;
            List<string> d = new List<string>();
            getlist(ex,ref d);

            var ss = d;
        }

        private void getlist(string strs,ref List<string> d)
        {
            if (strs.Length > 290)
            {
                string sy = "";
                string zj = strs.Substring(0, 290);
                int djindex = zj.LastIndexOf('。');
                d.Add(strs.Substring(0, djindex));

                sy = strs.Remove(0, djindex);
                getlist(sy, ref d);
            }
            else
            {
                d.Add(strs);
            }
        }

  

posted @ 2019-08-19 15:57  gds111789  阅读(443)  评论(0编辑  收藏  举报