How to insert newline in string literal?

前端 未结 12 773
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 09:07

In .NET I can provide both \\r or \\n string literals, but there is a way to insert something like \"new line\" special character like Enviro

12条回答
  •  感情败类
    2020-12-07 09:59

    If you are working with Web application you can try this.

    StringBuilder sb = new StringBuilder();
    sb.AppendLine("Some text with line one");
    sb.AppendLine("Some mpre text with line two");
    MyLabel.Text = sb.ToString().Replace(Environment.NewLine, "
    ")

提交回复
热议问题