Index: trunk/nv/string.hh
===================================================================
--- trunk/nv/string.hh	(revision 218)
+++ trunk/nv/string.hh	(revision 219)
@@ -7,4 +7,5 @@
 
 #include <string>
+#include <algorithm>
 #include <cstring>
 #include <sstream>
@@ -120,4 +121,75 @@
 	}
 
+	inline bool trim( std::string& str )
+	{
+		size_t endpos = str.find_last_not_of(" \r\n\t");
+		size_t startpos = str.find_first_not_of(" \r\n\t");
+
+		if ( string::npos != endpos || string::npos != startpos )
+		{
+			if ( string::npos == startpos ) startpos = 0;
+			if ( string::npos != endpos )   endpos = endpos+1-startpos;
+			str = str.substr( startpos, endpos );
+			return true;
+		}
+		return false;
+	}
+
+	inline bool rtrim( std::string& str )
+	{
+		size_t endpos = str.find_last_not_of(" \r\n\t");
+		if ( string::npos != endpos )
+		{
+			str = str.substr( 0, endpos+1 );
+			return true;
+		}
+		return false;
+	}
+
+	inline bool ltrim( std::string& str )
+	{
+		size_t startpos = str.find_first_not_of(" \r\n\t");
+		if( string::npos != startpos )
+		{
+			str = str.substr( startpos );
+			return true;
+		}
+		return false;
+	}
+
+	inline std::string trimmed( const std::string& str )
+	{
+		size_t endpos = str.find_last_not_of(" \r\n\t");
+		size_t startpos = str.find_first_not_of(" \r\n\t");
+
+		if ( string::npos != endpos || string::npos != startpos )
+		{
+			if ( string::npos == startpos ) startpos = 0;
+			if ( string::npos != endpos )   endpos = endpos+1-startpos;
+			return str.substr( startpos, endpos );
+		}
+		return str;
+	}
+
+	inline std::string rtrimmed( const std::string& str )
+	{
+		size_t endpos = str.find_last_not_of(" \r\n\t");
+		if ( string::npos != endpos )
+		{
+			return str.substr( 0, endpos+1 );
+		}
+		return str;
+	}
+
+	inline std::string ltrimmed( const std::string& str )
+	{
+		size_t startpos = str.find_first_not_of(" \r\n\t");
+		if( string::npos != startpos )
+		{
+			return str.substr( startpos );
+		}
+		return str;
+	}
+
 	inline bool ends_with( const std::string& s, const std::string & ending )
 	{
@@ -129,4 +201,18 @@
 	}
 
+	inline std::string& remove_chars( std::string& s, const std::string& chars ) 
+	{
+		s.erase(remove_if(s.begin(), s.end(), 
+			[&chars](const char& c) {
+				return chars.find(c) != std::string::npos;
+			}), s.end());
+		return s;
+	}
+
+	inline std::string remove_chars_copy( std::string s, const std::string& chars ) 
+	{
+		return remove_chars(s, chars);
+	}
+
 	template< typename T >
 	struct string_length
