No lines with text file with asp.net
The text file uses \ n or \ r \ n to get new lines (\ n is a newline character, and \ r is a carriage return on the day of the typescript entries you had to pull out in the panel from left to left, called carriage return and roll paper down the line to start on the left side of a new line -). Windows usually uses \ r \ n (although it depends on the application that created the file) mac usually uses \ n.
HTML on the other hand uses the <br/
> tag for new lines (if you use the viewource on your current html output you will see new lines). So all you have to do is replace \ r \ n or
. You can do it with:
yourstring = yourstring.Replace("\r\n", "<br/>");
or if you don't know exactly what is used in the file, or both \ r \ n and \ n are used, you can use
yourstring = yourstring.Replace("\r\n", "<br/>").Replace("\n", "<br/>");
remember that the string is immutable and thus methods such as Replace return a copy of the string that has the replacements made. The original string will remain unchanged.
source to share