How do you usually convert line breaks into a text field of a form or input = text element into html line breaks?
thanks
Edit: is it always \ r \ n with all browsers?
Or in C #:
myString.Replace("\r\n", "<br />");
If you are concerned that they are different on different platforms, you can also:
myString.Replace("\r\n", "<br />"); myString.Replace("\n", "<br />"); myString.Replace("\r", "<br />");
Is it always \ r \ n with all browsers?
It is processed on the server; it has nothing to do with the browser. However, I would suggest using:
System.Environment.NewLine
Replace(vbcrlf, "<br />")
Regex.Replace(urString, "\r?\n", "< br/>");
:
MyString.Replace(Chr(10), "<br/>")
, , , , .
MyString.Replace("\\r\\n", "<br />")
MyString.Replace("\\r\\n", Environment.NewLine)