Classes | Functions

strutil Namespace Reference

Classes

class  Tokenizer
 String Tokenizer. More...

Functions

string trimLeft (const string &str)
string trimRight (const string &str)
string trim (const string &str)
string trim (const string &str, const string &delimitor)
string toLower (const string &str)
string toUpper (const string &str)
bool startsWith (const string &str, const string &substr)
bool endsWith (const string &str, const string &substr)
bool equalsIgnoreCase (const string &str1, const string &str2)
template<bool >
bool parseString (const std::string &str)
string toString (const bool &value)
vector< string > split (const string &str, const string &delimiters)
std::string trimLeft (const std::string &str)
std::string trimRight (const std::string &str)
std::string trim (const std::string &str)
std::string trim (const std::string &str, const std::string &delimitor)
std::string toLower (const std::string &str)
std::string toUpper (const std::string &str)
bool startsWith (const std::string &str, const std::string &substr)
bool endsWith (const std::string &str, const std::string &substr)
bool equalsIgnoreCase (const std::string &str1, const std::string &str2)
template<class T >
parseHexString (const std::string &str)
template<class T >
std::string toString (const T &value)
template<class T >
std::string toHexString (const T &value, int width=0)
std::vector< std::string > split (const std::string &str, const std::string &delimiters)

Function Documentation

bool strutil::endsWith ( const string &  str,
const string &  substr 
)

Definition at line 63 of file StrUtil.cpp.

                                                           {

bool strutil::endsWith ( const std::string &  str,
const std::string &  substr 
)
bool strutil::equalsIgnoreCase ( const string &  str1,
const string &  str2 
)

Definition at line 67 of file StrUtil.cpp.

                                                                  {

bool strutil::equalsIgnoreCase ( const std::string &  str1,
const std::string &  str2 
)
template<class T >
T strutil::parseHexString ( const std::string &  str  ) 

Definition at line 92 of file strutil.h.

                                                             {
        T value;
        std::istringstream iss(str);
        iss >> hex >> value;
        return value;
    }

template<bool >
T strutil::parseString ( const std::string &  str  ) 

Definition at line 85 of file strutil.h.

                                                          {
        T value;
        std::istringstream iss(str);
        iss >> value;
        return value;
    }

vector<string> strutil::split ( const string &  str,
const string &  delimiters 
)

Definition at line 85 of file StrUtil.cpp.

                                                                      {
        vector<string> ss;

        Tokenizer tokenizer(str, delimiters);
        while (tokenizer.nextToken()) {
            ss.push_back(tokenizer.getToken());
        }

std::vector<std::string> strutil::split ( const std::string &  str,
const std::string &  delimiters 
)
bool strutil::startsWith ( const string &  str,
const string &  substr 
)

Definition at line 59 of file StrUtil.cpp.

                                                             {

bool strutil::startsWith ( const std::string &  str,
const std::string &  substr 
)
template<class T >
std::string strutil::toHexString ( const T &  value,
int  width = 0 
)

Definition at line 105 of file strutil.h.

                                                                       {
        std::ostringstream oss;
        oss << hex;
        if (width > 0) {
            oss << setw(width) << setfill('0');
        }
        oss << value;
        return oss.str();
    }

std::string strutil::toLower ( const std::string &  str  ) 
string strutil::toLower ( const string &  str  ) 

Definition at line 47 of file StrUtil.cpp.

                                          {
        string t = str;

template<class T >
std::string strutil::toString ( const T &  value  ) 

Definition at line 99 of file strutil.h.

                                                         {
        std::ostringstream oss;
        oss << value;
        return oss.str();
    }

std::string strutil::toString ( const bool value  ) 
std::string strutil::toUpper ( const std::string &  str  ) 
string strutil::toUpper ( const string &  str  ) 

Definition at line 53 of file StrUtil.cpp.

                                      {
        string t = str;

string strutil::trim ( const string &  str  ) 

Definition at line 33 of file StrUtil.cpp.

                                   {
        string t = str;
        t.erase(0, t.find_first_not_of(" \t\n\r"));

Here is the caller graph for this function:

std::string strutil::trim ( const std::string &  str,
const std::string &  delimitor 
)
std::string strutil::trim ( const std::string &  str  ) 
string strutil::trim ( const string &  str,
const string &  delimitor 
)

Definition at line 40 of file StrUtil.cpp.

                                                            {
        string t = str;
        t.erase(0, t.find_first_not_of(delimitor));

std::string strutil::trimLeft ( const std::string &  str  ) 
string strutil::trimLeft ( const string &  str  ) 

Definition at line 21 of file StrUtil.cpp.

                                       {
        string t = str;

string strutil::trimRight ( const string &  str  ) 

Definition at line 27 of file StrUtil.cpp.

                                        {
        string t = str;

std::string strutil::trimRight ( const std::string &  str  ) 
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Defines