I\'m currently using the following code to right-trim all the std::strings in my programs:
std::strings
std::string s; s.erase(s.find_last_not_of(\" \\n\\r\\
Here is my version:
size_t beg = s.find_first_not_of(" \r\n"); return (beg == string::npos) ? "" : in.substr(beg, s.find_last_not_of(" \r\n") - beg);