I have had success deleting all whitespace from a given string using the following:
1 #include <iostream>
2
3 void DeleteWS(std::s tring& x)
4 {
5 for(unsigned int i = 0; i <= x.length(); i++)
6 {
7 if(x[i] == ' ')
8 {
9 x.erase(i, 1);
10 }
11 }
12 }
13 int main()
14 ...
Leave a comment: