Index: trunk/FACT++/src/tools.cc
===================================================================
--- trunk/FACT++/src/tools.cc	(revision 10337)
+++ trunk/FACT++/src/tools.cc	(revision 10338)
@@ -49,2 +49,26 @@
     return str;
 }
+
+// --------------------------------------------------------------------------
+//
+//! This is a static helper to remove leading and trailing whitespaces.
+//!
+//! @param buf
+//!    a pointer to the char array from which the whitespaces should be
+//!    removed
+//!
+//! @returns
+//!    a std::string with the whitespaces removed from buf
+//
+string Trim(const string &str)
+{
+    // Trim Both leading and trailing spaces
+    const size_t start = str.find_first_not_of(' '); // Find the first character position after excluding leading blank spaces
+    const size_t end   = str.find_last_not_of(' ');  // Find the first character position from reverse af
+
+    // if all spaces or empty return an empty string
+    if (string::npos==start || string::npos==end)
+        return string();
+
+    return str.substr(start, end-start+1);
+}
Index: trunk/FACT++/src/tools.h
===================================================================
--- trunk/FACT++/src/tools.h	(revision 10337)
+++ trunk/FACT++/src/tools.h	(revision 10338)
@@ -3,2 +3,3 @@
 std::string Format(const char *fmt, va_list &ap);
 std::string Form(const char *fmt, ...);
+std::string Trim(const std::string &str);
