如何避免文本文件中最后一行后面的CRLF字符?
头的 LF
Start_one的 LF
Start_two的 LF
Start_three的 CRLF
来源:
string s = "\nStart_";
StringBuilder txt = new StringBuilder();
txt.Append("Header");
StringBuilder row = new StringBuilder();
row.Append(s + "one");
txt.Append(row);
row.Clear();
row.Append(s + "two");
txt.Append(row);
row.Clear();
row.Append(s + "three");
txt.Append(row);
row.Clear();
using (StreamWriter sw = File.CreateText(@"C:\Users\***\test.txt"))
{
sw.WriteLine(txt.ToString());
}