C#中,TextBox-MultiLine 會使用到顯示時直接換行。
换行符转换方法:
(1) string newline=this.txtbody.Text.Replace("\x0D\x0A", "<br />");
(2) string newline=this.txtbody.Text.Replace("\r\n", "<br />");
(3) string newline = this.txtbody.Text.Replace(Char.ConvertFromUtf32(13)+Char.ConvertFromUtf32(10), "<br />");
空格转换方法:
(1) string newline=this.txtbody.Text.Replace("\x20", " ");
(2) string newline=this.txtbody.Text.Replace(Char.ConvertFromUtf32(32), " ");