Whats the most efficient way of removing a \'newline\' from a std::string?
#include #include std::string str; str.erase(std::remove(str.begin(), str.end(), '\n'), str.end());
The behavior of std::remove may not quite be what you'd expect. See an explanation of it here.