From 8d65e5e2655afb69b6568049f5551984366f17fb Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Tue, 24 Dec 2013 20:22:21 -0500 Subject: [PATCH] adding trim method --- include/fc/string.hpp | 1 + src/string.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/fc/string.hpp b/include/fc/string.hpp index 5a53cd9..5afeb9f 100644 --- a/include/fc/string.hpp +++ b/include/fc/string.hpp @@ -19,6 +19,7 @@ namespace fc typedef fc::optional ostring; class variant_object; fc::string format_string( const fc::string&, const variant_object& ); + fc::string trim( const fc::string& ); } #else diff --git a/src/string.cpp b/src/string.cpp index be55ca6..ce79a9c 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include @@ -97,7 +98,12 @@ namespace fc { { return boost::lexical_cast(d); } - + std::string trim( const std::string& s ) + { + std::string cpy(s); + boost::algorithm::trim(cpy); + return cpy; + } } // namespace fc