Namespaces |
namespace | string_util |
| some common string processing functions, for std::string
|
Functions |
char | string_util::localeToUpper (char c) |
| uses the standard library's "locale" to convert case of a single character
|
char | string_util::localeToLower (char c) |
| uses the standard library's "locale" to convert case of a single character
|
string | string_util::makeLower (const std::string &s) ATTR_must_check |
| returns lower case version of s
|
string | string_util::makeUpper (const std::string &s) ATTR_must_check |
| returns upper case version of s
|
string | string_util::removePrefix (const std::string &str, const std::string &pre) ATTR_must_check |
| returns str with pre removed - if pre is not fully matched, str is returned unchanged
|
string | string_util::trim (const std::string &str) ATTR_must_check |
| removes whitespace (as defined by isspace()) from the beginning and end of str, and returns the result
|
bool | string_util::beginsWith (const std::string &str, const std::string &prefix) |
| returns true if str begins with prefix
|
bool | string_util::endsWith (const std::string &str, const std::string &suffix) |
| returns true if str ends with suffix
|
std::string | string_util::makePath (const std::string &rel, const std::string &path) |
| Returns tgt if it is an absolute path or rel is empty, otherwise drops trailing file (if any) from rel and appends tgt.
|
std::vector< std::string > | string_util::tokenize (const std::string &str, const std::string &delims=", \t") |
| convert input string into vector of string tokens
|
bool | string_util::parseArgs (const std::string &input, std::vector< std::string > &args, std::vector< unsigned int > &offsets) |
| parses the input string into an arg list, with corresponding offsets of each arg in the original input
|
string | string_util::tildeExpansion (const std::string &str) ATTR_must_check |
| replaces ~USER prefix with specified user's home directory, or ~ prefix with current HOME environment setting; returns str if no valid expansion is found
|
bool | string_util::reMatch (const std::string &str, const std::string ®ex) |
| returns true if str matches re (assumes 'extended' regular expression, not 'basic'), false otherwise and throws std::string message on error
|
bool | string_util::reMatch (const std::string &str, const std::string ®ex, int flags) |
| returns true if str matches re (with optional flags to control interpretation), false otherwise and throws std::string message on error
|
std::string | string_util::intToStringIP (int ip) |
| Converts a int representation of an IP to a string.
|
int | string_util::stringToIntIP (std::string ip) |
| Converts a string representation of an IP to an int.
|
size_t | string_util::utf8len (const std::string &str) |
| returns the number of utf8 code points found in the string
|
std::string | string_util::demangle (const std::string &symbol) |
| returns demangled version of a symbol name
|
std::string | string_util::int2str (int const n) |
| convert int to string so robot can speak numbers
|