var s = "hello world"; Console.WriteLine(s.Replace(' ', '_')); Console.WriteLine(s.Replace("world", "C#"));
swap chars or substrings