Public Member Functions | ||||
StringTrim () | ||||
Default constructor. | ||||
Static Public Member Functions | ||||
static std::string & | toLowerCase (std::string &ref) | |||
This method converts a string to lowercase. | ||||
static std::string | replaceAll (std::string &str, std::string &from, std::string &to) | |||
Replace all occurrences of "from" with to "to". | ||||
static bool | isTrue (std::string &str) | |||
Checks string to be interpreted as true. | ||||
static bool | isTrue (std::string &str, bool def) | |||
Evaluate trimmed boolean string. | ||||
static bool | isTrueTrim (std::string &str) | |||
Use this method instead of isTrue(std::string&) if your input std::string may be manipulated (it performs a bit better then the other method). | ||||
static std::string | trimStart (char *str) | |||
Trims the start of the std::string (whitespaces, newlines etc. | ||||
static std::string & | trimStart (std::string &str) | |||
| ||||
static std::string | trimEnd (char *str) | |||
Trims all spaces from the end of the std::string (whitespaces, newlines etc). | ||||
static std::string & | trimEnd (std::string &str) | |||
| ||||
static std::string | trim (char *str) | |||
Trims all spaces (like blanks and newlines) at the start and the end of the std::string. | ||||
static void | trim (std::string &str) | |||
| ||||
static std::string | trim (std::string &str) |
It can be instantiated with which character type you want and will therefore work even with xerces XMLCh* std::strings. This class is part of the package because the XMLString::trim(...) method in the xerces package does not fullfill our requirements.
Definition at line 31 of file StringTrim.h.
org::xmlBlaster::util::StringTrim::StringTrim | ( | ) |
static std::string& org::xmlBlaster::util::StringTrim::toLowerCase | ( | std::string & | ref | ) | [static] |
This method converts a string to lowercase.
Note that the input string is modified and a reference to it is returned.
Definition at line 46 of file StringTrim.h.
static std::string org::xmlBlaster::util::StringTrim::replaceAll | ( | std::string & | str, | |
std::string & | from, | |||
std::string & | to | |||
) | [static] |
Replace all occurrences of "from" with to "to".
Definition at line 59 of file StringTrim.h.
Referenced by org::xmlBlaster::client::qos::SubscribeQos::generateSubscriptionId().
static bool org::xmlBlaster::util::StringTrim::isTrue | ( | std::string & | str | ) | [static] |
Checks string to be interpreted as true.
If you don't need trimming please use lexical_cast<bool>(str) instead of this method.
str | The checked std::string (is not modified) |
Definition at line 88 of file StringTrim.h.
References org::xmlBlaster::util::lexical_cast().
static bool org::xmlBlaster::util::StringTrim::isTrue | ( | std::string & | str, | |
bool | def | |||
) | [static] |
Evaluate trimmed boolean string.
str | The checked std::string (is not modified) | |
def | Default value to use if str not one of described below |
Definition at line 100 of file StringTrim.h.
static bool org::xmlBlaster::util::StringTrim::isTrueTrim | ( | std::string & | str | ) | [static] |
Use this method instead of isTrue(std::string&) if your input std::string may be manipulated (it performs a bit better then the other method).
NOTE: It returns true if the str is empty, this is nice for SAX parse where <persistent> also triggers an endElement() with empty character_ and means 'true'.
str | The checked std::string (is trimmed!!) |
Definition at line 116 of file StringTrim.h.
References org::xmlBlaster::util::lexical_cast().
static std::string org::xmlBlaster::util::StringTrim::trimStart | ( | char * | str | ) | [static] |
Trims the start of the std::string (whitespaces, newlines etc.
).
Definition at line 138 of file StringTrim.h.
References EMPTY_STRING.
Referenced by org::xmlBlaster::test::TestStringTrim::testTrim().
static std::string& org::xmlBlaster::util::StringTrim::trimStart | ( | std::string & | str | ) | [static] |
str | The given std::string will be trimmed (in - out parameter) |
Returns | the trimmed given parameter (the str instance) |
Definition at line 158 of file StringTrim.h.
static std::string org::xmlBlaster::util::StringTrim::trimEnd | ( | char * | str | ) | [static] |
Trims all spaces from the end of the std::string (whitespaces, newlines etc).
Definition at line 180 of file StringTrim.h.
References EMPTY_STRING.
Referenced by org::xmlBlaster::test::TestStringTrim::testTrim().
static std::string& org::xmlBlaster::util::StringTrim::trimEnd | ( | std::string & | str | ) | [static] |
str | The given std::string will be trimmed (in - out parameter) |
Returns | the trimmed given parameter (the str instance) |
Definition at line 193 of file StringTrim.h.
References EMPTY_STRING.
static std::string org::xmlBlaster::util::StringTrim::trim | ( | char * | str | ) | [static] |
Trims all spaces (like blanks and newlines) at the start and the end of the std::string.
" \t Hello \t World \n" -> "Hello \t World"
str | The given std::string |
Definition at line 217 of file StringTrim.h.
References EMPTY_STRING.
Referenced by org::xmlBlaster::util::parser::Sax2Parser::getStringValue(), and org::xmlBlaster::test::TestStringTrim::testTrim().
static void org::xmlBlaster::util::StringTrim::trim | ( | std::string & | str | ) | [static] |
str | The given std::string will be trimmed (in - out parameter) |
Returns | the trimmed given parameter (the str instance) |
Definition at line 229 of file StringTrim.h.
References EMPTY_STRING.
static std::string org::xmlBlaster::util::StringTrim::trim | ( | std::string & | str | ) | [static] |
Definition at line 257 of file StringTrim.h.