string str = "aaa bbb ccc ddd";str = Regex.Replace(str, " ", "", RegexOptions.IgnoreCase);或者str = str.Replace(" ", "");