C# Replace \ to space code example Example: remove whitespace between string c# string str = "C Sharp"; str = Regex.Replace(str, @"\s", "");