CSharp - String String replace

Introduction

Replace method replaces all occurrences of a particular character or substring:

Demo

using System;
class MainClass/*w  w  w . j a  va2s .c o  m*/
{
   public static void Main(string[] args)
   {

     Console.WriteLine ("this is a test".Replace (" ", " | ") );  
     Console.WriteLine ("this is a test".Replace (" ", "")    );  

   }
}

Result