我正在尝试查找字符串中每个出现的 ASCII 字符并将其替换为新行。这是我到目前为止所拥有的:
public string parseText(string inTxt)
{
//String builder based on the string passed into the method
StringBuilder n = new StringBuilder(inTxt);
//Convert the ASCII character we're looking for to a string
string replaceMe = char.ConvertFromUtf32(187);
//Replace all occurences of string with a new line
n.Replace(replaceMe, Environment.NewLine);
//Convert our StringBuilder to a string and output it
return n.ToString();
}
这不会添加新行,并且字符串都保留在一行上。我不确定这里有什么问题。我也试过这个,但结果相同:
n.Replace(replaceMe, "\n");
有什么建议么?