【发布时间】:2013-07-10 03:44:50
【问题描述】:
在What is the easiest way in C# to trim a newline off of a string? 的帖子上,我看来相同的东西对他们有用,但它在我的字符串开头留下了新行。没有错误,它只是不修剪任何东西。
public formWords()
{
foreach (string word in someArray)
{
fileList += Environment.NewLine + word;
}
fileList.Trim(Environment.NewLine.ToCharArray());
txtHolder.Text = fileList;
}
我做错了什么?
提前致谢。
【问题讨论】:
-
Windows 中的
NewLine中有两个char...\r和\n。