Remove extra spaces and tabs from a string of characters.

string TextWithExtraSpaces = "The    Quick   Brown   Fox    Jumps    Over          A           Lazy Dog.";
string TextWithExtraSpacesRemoved = System.Text.RegularExpressions.Regex.Replace(TextWithExtraSpaces, "\\s+", " ");

No comments:

Post a Comment