Saturday, June 14, 2008

C++ How to trim a string

To trim a string in C++ you should use the Boost library. Writing C++ without Boost is no fun. Boost provides great libraries for almost any c++ work and its a proving ground for future revisions of the c++ standard library.

So how do you trim a string in c++ using boost?
#include <iostream>
#include <boost/algorithm/string/trim.hpp>

int main(int argc, char * argv[]) {

  cout << trim(argv[1]);

No comments: