Re: Downloading unix \n text files, convert to \r\n non-unix?
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Thu, 05 Apr 2007 18:36:34 -0400
Zytan wrote:
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!
No.
It replace \n with \r\n without replacing \r\n with \r\r\n.
Arne
.
- Follow-Ups:
- References:
- Downloading unix \n text files, convert to \r\n non-unix?
- From: Zytan
- Re: Downloading unix \n text files, convert to \r\n non-unix?
- From: Zytan
- Re: Downloading unix \n text files, convert to \r\n non-unix?
- From: Arne Vajhøj
- Re: Downloading unix \n text files, convert to \r\n non-unix?
- From: Arne Vajhøj
- Re: Downloading unix \n text files, convert to \r\n non-unix?
- From: Zytan
- Downloading unix \n text files, convert to \r\n non-unix?
- Prev by Date: Re: Inter-process communication
- Next by Date: Re: How to use IEquatable?
- Previous by thread: Re: Downloading unix \n text files, convert to \r\n non-unix?
- Next by thread: Re: Downloading unix \n text files, convert to \r\n non-unix?
- Index(es):