字符串操作 字符串里所有的的换行符都去掉:textStr = Regex.Replace(textStr, @"[/n/r]", ""); 去掉末尾的换行符:textStr = textStr.TrimEnd((char[])"/n/r".ToCharArray());