CSharp - String String replace

Introduction

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

Demo

using System;
class MainClass//ww  w.  j a  v a  2 s  .  co  m
{
   public static void Main(string[] args)
   {

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

   }
}

Result