How to remove whitespaces between characters in c#?
Trim() can be used to remove the empty spaces at the beginning of the string as well as at the end.
Trim()
var str=" c sharp "; str = str.Trim(); str = Regex.Replace(str, @"\s+", " "); ///"c sharp"