Tuesday, December 21, 2010

Removing leading and trailing whitespace in C++

If you have the boost library installed, its simply a one liner

std::string line = "     hello world    ";
boost::algorithm::trim(line);