C# 去掉代码前边空格(格式化代码)

        private void button1_Click(object sender, EventArgs e)
        {
            textBox2.Text = "";
            string str = "";
            foreach (string s2 in textBox1.Lines)
            {
                if(s2==""){
                    continue;
                }
                str += s2.Trim()+"\r\n";
            }
            textBox2.Text = str;
        }

 

posted @ 2018-07-11 17:43  enych  阅读(408)  评论(0编辑  收藏  举报