Convert Unix Linefeeds To DOS C#
Googled around for a quick way to fix line feeds in a string on a Windows computer and found all sorts of silly suggestions (converting all Windows line feeds to Unix, then Unix to Windows or worse just adding additional \r's to all \n's you see, even if they are already correct Windows linefeeds) when really we could just do it in a regular expression.
Here is my code:
Simples!
Here is my code:
// This will convert any Linux line feeds to Windows line feeds.
private static object CorrectLineFeeds(string message)
{ return Regex.Replace(message, "([^\r])\n", "$1\r\n"); }
private static object CorrectLineFeeds(string message)
{ return Regex.Replace(message, "([^\r])\n", "$1\r\n"); }
Simples!
Matthew1471's ASP 


