What is the preferred way to remove spaces from a string in C++? I could loop through all the characters and build a new string, but is there a better way?
string str = "2C F4 32 3C B9 DE"; str.erase(remove(str.begin(),str.end(),' '),str.end()); cout << str << endl;
output: 2CF4323CB9DE