--- 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 <stdarg.h>
#include <float.h>
#include <pthread.h>
+#include <string>
+
+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