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