#include <StrUtil.h>
Static Public Member Functions | |
| static Boolean_t | isWhiteSpace (const char C) |
| Determine if the specified characater is whitespace or not. | |
| static void | trim (std::string &str) |
| Remove leading whitespace from a string. | |
| static Boolean_t | scanForSymbol (std::string &str, const char symbol) |
| Find and remove a symbol for the beginning of a string. | |
| static Boolean_t | scanForLgIndex (std::string &str, LgIndex_t *value) |
| Find a LgIndex_t value at the beginning of a string. | |
| static void | toUpper (std::string &str) |
| Convert the supplied string to uppercase. | |
| static void | toLower (std::string &str) |
| Convert the supplied string to uppercase. | |
| static std::vector< std::string > | split (std::string str, std::string delimiters=",", bool discardEmptyStrings=false) |
| Splits a string around matches of the supplied delimiters. | |
| static Boolean_t tecplot::toolbox::StrUtil::isWhiteSpace | ( | const char | C | ) | [static] |
Determine if the specified characater is whitespace or not.
| C | Character to check. |
| static void tecplot::toolbox::StrUtil::trim | ( | std::string & | str | ) | [static] |
Remove leading whitespace from a string.
| str | String which should have white space removed. |
std::string strValue(" \t Hi Mom\n"); cout << strValue.c_str(); trimWhiteSpace(strValue); cout << strValue.c_str(); Output: " Hi Mom" "Hi Mom"
| static Boolean_t tecplot::toolbox::StrUtil::scanForSymbol | ( | std::string & | str, | |
| const char | symbol | |||
| ) | [static] |
Find and remove a symbol for the beginning of a string.
| str | String in which to search for the symbol | |
| symbol | Character to search for |
std::string strValue(" [1,2,3]\n"); cout << strValue.c_str(); scanForSymbol(strValue, '!'); cout << strValue.c_str(); scanForSymbol(strValue, '['); cout << strValue.c_str(); Output: " [1,2,3]" // Original string "[1,2,3]" // After looking for '!', the leading whitespace is trimmed "1,2,3]" // Found '[' and removed it.
| static Boolean_t tecplot::toolbox::StrUtil::scanForLgIndex | ( | std::string & | str, | |
| LgIndex_t * | value | |||
| ) | [static] |
Find a LgIndex_t value at the beginning of a string.
| str | String in which to search for a LgIndex_t value. | |
| value | LgIndex_t pointer in which to stuff the result. |
std::string strValue("1,2,3\n"); cout << strValue.c_str(); LgIndex_t value; scanForLgIndex(strValue, &value); cout << strValue.c_str(); Output: "1,2,3" // Original string ",2,3" // After looking for the LgIndex_t value
| static void tecplot::toolbox::StrUtil::toUpper | ( | std::string & | str | ) | [static] |
Convert the supplied string to uppercase.
| str | The string to be converted to uppercase. |
| static void tecplot::toolbox::StrUtil::toLower | ( | std::string & | str | ) | [static] |
Convert the supplied string to uppercase.
| str | The string to be converted to uppercase. |
| static std::vector<std::string> tecplot::toolbox::StrUtil::split | ( | std::string | str, | |
| std::string | delimiters = ",", |
|||
| bool | discardEmptyStrings = false | |||
| ) | [static] |
Splits a string around matches of the supplied delimiters.
| str | The delmited string to be split | |
| delimiters | Zero or more characters to be used as delimiters. If the delimiter is a zero length string, the input string will not be split. | |
| discardEmptyStrings | If true, empty strings will not be included in the result If false, empty strings may be included in the result |
StrUtil::split("a,b,,c,", ",", false); // result will be: { "a", "b", "", "c", "" } StrUtil::split("a,b,,c,", ",", true); // result will be: { "a", "b", "c" } StrUtil::split("hi,mom;hi,\n;dad", ",\n;", false); // result will be: {"hi", "mom", "hi", "", "", "dad"} StrUtil::split("hi,mom;hi,\n;dad", ",\n;", true); // result will be: {"hi", "mom", "hi", "dad"}
1.5.5