My string is Following:
string mystring ="Test1234\r\ntest1234\r\ntest1234\r\ntest dhjfadhdfsfdsjfdf";
It comes from a database and I want to display it in a label as usual format. So, I want to replace \r\n to <br>.
I tried using NewString= mystring .Replace('\r\n','<br>');, but it didn’t work.
I got the following error
To many characters in character literal`.If this is not a correct way to do suggest.Thanks.
Try this instead, replacing the single quotes with double quotes:
Using single quotes indicates that you are going to specify a char instead of a string. You then passed in a string literal consisting of two characters ( the \r and the \n) rather than a single character, causing the error.