29 #include <boost/algorithm/string.hpp>
31 #include "WStringUtils.h"
37 std::string str = source;
38 str.erase( str.find_last_not_of( t ) + 1 );
44 std::string str = source;
45 str.erase( 0 , source.find_first_not_of( t ) );
51 std::string str = source;
57 std::string str = source;
58 std::transform( source.begin(), source.end(), str.begin(), ::toupper );
64 std::string str = source;
65 std::transform( source.begin(), source.end(), str.begin(), ::tolower );
70 const std::string& delim,
73 std::vector< std::string > result;
74 namespace ba = boost::algorithm;
75 ba::token_compress_mode_type compression = ba::token_compress_on;
78 compression = ba::token_compress_off;
80 ba::split( result, source, ba::is_any_of( delim ), compression );
86 if( result.back() ==
"" )
std::string toLower(const std::string &source)
Transforms all characters in the given string into lower case characters.
std::string toUpper(const std::string &source)
Transforms all characters in the given string into upper case characters.
std::vector< std::string > tokenize(const std::string &source, const std::string &delim=WHITESPACE, bool compress=true)
Splits the given string into a vector of strings (so called tokens).
std::string trim(const std::string &source, const std::string &t=WHITESPACE)
Trims any occurence of each character given in parameter t from both ends (right and left side) of th...
const std::string WHITESPACE
We consider the following characters as whitespace:
std::string rTrim(const std::string &source, const std::string &t=WHITESPACE)
Trims any occurence of each character given in parameter t from the end (or right side) of the given ...
std::string lTrim(const std::string &source, const std::string &t=WHITESPACE)
Trims any occurence of each character given in parameter t from the start (or left side) of the given...