7 static std::vector<std::string> & split(
const std::string & s,
char delim, std::vector<std::string> & elems )
9 std::stringstream ss( s );
11 while( std::getline( ss, item, delim ) )
13 elems.push_back( item );
19 std::vector<std::string> Wtx::Core::split(
const std::string & s,
char delim )
21 std::vector<std::string> elems;
22 ::split( s, delim, elems );
26 const char* Wtx::Core::trim_ws =
" \t\n\r\f\v";
29 std::string & Wtx::Core::rtrim( std::string & s,
const char* t )
31 s.erase( s.find_last_not_of(t) + 1 );
36 std::string & Wtx::Core::ltrim( std::string & s,
const char* t )
38 s.erase( 0, s.find_first_not_of(t) );
43 std::string & Wtx::Core::trim( std::string & s,
const char* t )
45 return ltrim( rtrim(s, t), t );
48 std::string Wtx::Core::toupper(
const std::string & s )
50 std::string retVal = s;
52 std::transform( retVal.begin(), retVal.end(), retVal.begin(), ::toupper );
57 std::string Wtx::Core::tolower(
const std::string & s )
59 std::string retVal = s;
61 std::transform( retVal.begin(), retVal.end(), retVal.begin(), ::tolower );