去除换行符

一般处理可以使用 Replace(" ", ""); 来替换

如果文件路径带换行符的会错误(路径中有非法字符或者系统找不到文件)

11557125

string s = @"C:WindowsSystem32cmd.exe" + "
"; 
richTextBox1.LoadFile(s);

11640812

string s = @"C:WindowsSystem32cmd.exe" + "
"; 
System.Diagnostics.Process.Start(s);

替换

textBox1.Text =textBox1.Text.Replace("
", "");

替换

textBox1.Text =textBox1.Text.Replace("
", "");
原文地址:https://www.cnblogs.com/xe2011/p/3438812.html