What is a quick way to force CRLF in C# / .NET?

前端 未结 6 1519
独厮守ぢ
独厮守ぢ 2020-12-08 13:38

How would you normalize all new-line sequences in a string to one type?

I\'m looking to make them all CRLF for the purpose of email (MIME documents). Ideally this w

6条回答
  •  庸人自扰
    2020-12-08 14:08

    string nonNormalized = "\r\n\n\r";
    
    string normalized = nonNormalized.Replace("\r", "\n").Replace("\n", "\r\n");
    

提交回复
热议问题