Possible Duplicate:
What's the best way to trim std::string
I have a string:
std::string foo = "This is a string "; // 4 spaces at end How would I remove the spaces at the end of the string so that it is:
"This is a string" // no spaces at end please note this is an example and not a representation of my code. I do not want to hard code:
std::string foo = "This is a string"; //wrong
trim, check out for example stackoverflow.com/questions/216823/…