” so that they are properly rendered in the browser. There seems to be quite a few ways to do it but the simplest method which always worked for me is as follows. Just pass the string to the the function and it will format the string properly so that the new line characters are replaced with “
” tags
public static string ConvertToBR(string InputString)
{
string Pattern = "\\n";
Regex Rgx = new Regex(Pattern);
string OutputString = Rgx.Replace(InputString, "
");
return OutputString;
}