How can I replace multiple spaces in a string with only one space in C#?
Example:
1 2 3 4 5
would be:
I can remove whitespaces with this
while word.contains(" ") //double space word = word.Replace(" "," "); //replace double space by single space. word = word.trim(); //to remove single whitespces from start & end.