Remove whitespace within string
var s = "This is a string with multiple white space";
Regex.Replace(s, @"\s+", " "); // "This is a string with multiple white space"
Regex r = new Regex(@"\s+");
string stripped = r.Replace("Too many spaces", " ");
Here's a nice way without regex. With Linq.
var astring = "This is a string with to many spaces.";
astring = string.Join(" ", astring.Split(' ').Where(m => m != string.Empty));
output "This is a string with to many spaces"