This is actually what I found from the hard disk. It's old '''
In C #, when we input data in the text box (textbox), we can wrap the line (multiline text box), or enter a space in the multilin text box. However, when we read the data in the text box, we can use a space to display the data in another text box or directly use response. when the Write statement is displayed, we cannot display the line breaks and spaces as expected. The line breaks and spaces (the same applies to multiple spaces) are displayed with one space. Therefore, we need a method that can convert spaces and line breaks:
In C #, the line feed is represented by "\ r \ n". The Unicode codes of \ r and \ n are respectively 13 and 10, indicating that the Unicode codes of spaces are 32.
1. line feed conversion: (there are three types)
1 StringNewline=Textbox1.text. Replace ("\ X0d \ x0a","<Br/>");
2 StringNewline=Textbox1.text. Replace ("\ R \ n","<Br/>");
3 StringNewline=Textbox1.text. Replace (char. convertfromutf32 (13) Char. convertfromutf32 (10),"<Br/>");//<Br/> it is my habit or can be written <br>
2. space conversion: (2 types)
1 StringNewline=Textbox1.text. Replace ("\ X20","& Nbsp;");
2 StringNewline=Textbox1.text. Replace (char. convertfromutf32 (32),"& Nbsp;");
If you have the same habits as me and like to use <br/>: If you like the same, if the line and space must be converted, please first convert the space and then convert the line feed, otherwise, the line feed cannot be displayed. In my opinion, the space conversion converts the line feed to the space in <br personal display space/>.
For example:
Label1.text=(Textbox1.text. Replace (char. convertfromutf32 (32),"& Nbsp;"). Replace (char. convertfromutf32 (13) Char. convertfromutf32 (10),"<Br/> convertfromutf textbox replac;");
Or
Label1.text=(Textbox1.text. Replace (char. convertfromutf32 (13) Char. convertfromutf32 (10),"<Br>"). Replace (char. convertfromutf32 (32),"& Nbspconvertfromutf textbox replac;"));