diff options
author | vng <viktor.govako@gmail.com> | 2012-08-23 21:48:01 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:42:27 +0300 |
commit | 339f1a2919d120bd2a00ee34e7ee1056e19999d3 (patch) | |
tree | 8801ae9bbd646c25e49cf928e293df42afa6705f /base | |
parent | f8679434b8f1e2668d447dc8eb11ca0c7c168fb6 (diff) |
Add strings::Trim.
Diffstat (limited to 'base')
-rw-r--r-- | base/string_utils.cpp | 8 | ||||
-rw-r--r-- | base/string_utils.hpp | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/base/string_utils.cpp b/base/string_utils.cpp index 41862ae82a..d29f24efca 100644 --- a/base/string_utils.cpp +++ b/base/string_utils.cpp @@ -4,6 +4,9 @@ #include "../std/target_os.hpp" #include "../std/iterator.hpp" +#include <boost/algorithm/string.hpp> // boost::trim + + namespace strings { @@ -120,6 +123,11 @@ void AsciiToLower(string & s) transform(s.begin(), s.end(), s.begin(), &ascii_to_lower); } +void Trim(string & s) +{ + boost::trim(s); +} + bool EqualNoCase(string const & s1, string const & s2) { return MakeLowerCase(s1) == MakeLowerCase(s2); diff --git a/base/string_utils.hpp b/base/string_utils.hpp index 7268b8b0c6..ec1f82d5ee 100644 --- a/base/string_utils.hpp +++ b/base/string_utils.hpp @@ -32,6 +32,7 @@ UniString Normalize(UniString const & s); void Normalize(UniString & s); void AsciiToLower(string & s); +void Trim(string & s); void MakeLowerCase(string & s); string MakeLowerCase(string const & s); |