Re: Downloading unix \n text files, convert to \r\n non-unix?



But I think:

string s = "A\nBB\nCCC";
Console.WriteLine(s.Length);
s = Regex.Replace(s, "(?<!\r)\n", Environment.NewLine);
Console.WriteLine(s.Length);

is better code !

Thanks, Arne. So, this replaces both \r and \r\n with the proper
newline. So, this should work for any string! great!

Zytan

.



Relevant Pages


Loading