How can I replace the line break of a textbox (multiline-box) by the html's <br>
?
This is my code:
string output = tb_Notizen.Text.Replace("\\r\\n", "<br>");
Whats wrong here?
I already tried it with \r\n
but it didn't worked too...
How can I replace the line break of a textbox (multiline-box) by the html's <br>
?
This is my code:
string output = tb_Notizen.Text.Replace("\\r\\n", "<br>");
Whats wrong here?
I already tried it with \r\n
but it didn't worked too...
Better try with Environment.NewLine because \r
and \n
are platform dependant.
\n is Unix, \r is Mac, \r\n is Windows
Environment.NewLine would return any of the above based on the operating system.
string output = tb_Notizen.Text.Replace(Environment.NewLine, "<br>");