How to replace all newlines in a string with C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string s = "c# \n c c++ \n java python\n";
        
        s = s.Replace(System.Environment.NewLine, "WWW");

        Console.Write(s);
    }
}



/*
run:
 
c# WWW c c++ WWW java pythonWWW
 
*/

 



answered Nov 26, 2021 by avibootz
...