diff -r dbe8438d5dca -r 9569e9f35374 include/common.h --- a/include/common.h Tue Apr 22 13:33:12 2008 +0200 +++ b/include/common.h Wed Apr 23 10:38:33 2008 +0200 @@ -31,6 +31,9 @@ #include #include #include +#include + +using namespace std; #ifdef PYRIT_DOUBLE # define Float double @@ -107,4 +110,19 @@ } } +inline void trim(string& s) +{ + const char *ws = " \n"; + string::size_type pos = s.find_last_not_of(ws); + if (pos != string::npos) + { + s.erase(pos + 1); + pos = s.find_first_not_of(ws); + if (pos != string::npos) + s.erase(0, pos); + } + else + s.erase(s.begin(), s.end()); +} + #endif