Basic Image AlgorithmS Library
2.8.0
|
Contains some useful methods for string manipulation. More...
#include <Utils/StringUtils.hh>
Static Public Member Functions | |
static bool | CompareNoCase (const std::string &str1, const std::string &str2) |
compare two strings ignoring their case More... | |
static void | Explode (const std::string &str, const std::string &seperator, std::vector< std::string > &ret) |
Explodes the given string into tokens which are separated by the given separator string. More... | |
static std::string | LeadingZeroString (int value, int num) |
static std::string | PadUintByMaxValue (unsigned int value, unsigned int max) |
Pads the given value with leading zeroes so that the string representation will use the same number of characters as max. More... | |
static std::string | PadUintByNumChars (unsigned int value, unsigned int num) |
Pads the given number with leading zeroes so that the string representation will use the number of characters determined by num (if it is not already bigger). More... | |
static void | SplitByChars (const std::string &str, std::vector< std::string > &ret, const std::string &charsToSplit="\t\n ,;") |
Splits the given string into tokens which are separated by any of the given separator characters (similar to #StringUtils::Explode). More... | |
static void | Trim (const std::string &str, std::string &ret, const std::string &charsToTrim=" \t\n") |
Trims the given string, i.e. More... | |
Contains some useful methods for string manipulation.
Definition at line 47 of file StringUtils.hh.
|
inlinestatic |
compare two strings ignoring their case
[in] | str1 | first string to compare |
[in] | str2 | second string to compare |
Definition at line 122 of file StringUtils.hh.
|
static |
Explodes the given string into tokens which are separated by the given separator string.
Usage example:
std::vector<std::string> retVec; StringUtils.Explode("token1 token2 token3", " ", retVec);
retVec will now contain the three elements "token1", "token2" and "token3"
str | the string to explode |
seperator | the string that separates each token from the next |
ret | a vector that contains the single tokens |
Definition at line 27 of file StringUtils.cpp.
|
inlinestatic |
Definition at line 134 of file StringUtils.hh.
|
inlinestatic |
Pads the given value with leading zeroes so that the string representation will use the same number of characters as max.
value | the value to pad |
max | value is padded to use the same number of characters as this one |
Definition at line 171 of file StringUtils.hh.
|
inlinestatic |
Pads the given number with leading zeroes so that the string representation will use the number of characters determined by num (if it is not already bigger).
value | the value to pad |
num | value is padded to use this number of characters |
Definition at line 152 of file StringUtils.hh.
|
static |
Splits the given string into tokens which are separated by any of the given separator characters (similar to #StringUtils::Explode).
str | the string to split |
ret | a vector that contains the single tokens |
seperator | the characters that separate each token from the next |
Definition at line 59 of file StringUtils.cpp.
|
static |
Trims the given string, i.e.
removes all permutations of the given charsToTrim from the front and the end of the string.
Usage example:
std::string retStr; StringUtils::Trim("_/_string_/_", retStr, "/_");
retStr will now be "string"
str | the string to trim |
ret | the trimmed string |
charsToTrim | the characters to remove from the front and the end of the string. the default is to remove all whitespace charakters (spaces, tabs and newlines). note that the order of characters is irrelevant |
Definition at line 81 of file StringUtils.cpp.