-3

如何用 html 替换文本框(多行框)的换行符<br>

这是我的代码:

string output = tb_Notizen.Text.Replace("\\r\\n", "<br>");

这里有什么问题?

我已经尝试过了,\r\n但它也没有奏效......

4

1 回答 1

1

更好地尝试使用Environment.NewLine因为\r并且\n依赖于平台。

\n 是 Unix,\r 是 Mac,\r\n 是 Windows

Environment.NewLine 将根据操作系统返回上述任何内容。

string output = tb_Notizen.Text.Replace(Environment.NewLine, "<br>");
于 2013-11-13T05:01:42.603 回答