字符串去除折行合并内容

2015-03-08 10:10:22  访问(2414) 赞(0) 踩(0)


        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripButton_生成_Click(object sender, EventArgs e)
        {
            string str = richTextBox_Text.Text.Trim();

            string[] sArray = str.Split(new char[] { '\n' });

            StringBuilder theResult = new StringBuilder();

            foreach (string s in sArray)
            {
                if (s == null || s.Length == 0)
                    continue;

                theResult.Append(s.Trim());
            }

            richTextBox_Text.Text = theResult.ToString();
        }


上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)