SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
Static Public Member Functions | |
static std::string & | trim (std::string &s) |
Trim whitespace from both ends of a string (in place). | |
static std::string & | trimLeft (std::string &s) |
Trim whitespace from start of string (in place). | |
static std::string & | trimRight (std::string &s) |
Trim whitespace from end of string (in place). | |
static std::string & | lower (std::string &s) |
Transform string to all-lowercase letters (in place). | |
static std::string & | upper (std::string &s) |
Transform string to all-uppercase letters (in place). | |
static std::vector< std::string > | split (const std::string &s, const std::string &sep, bool omitEmpty, bool trim) |
Split string into a vector of strings at each occurrence of sep (including or omitting empty strings at double-separators) | |
static bool | endsWith (const std::string &ss, const std::string &ending) |
Return true if and only if ss ends with ending. | |
static std::size_t | replaceAll (std::string &source, const std::string &search, const std::string &replacement) |
Perform in-place replacement of search with replacement. More... | |
static std::size_t | replaceOne (std::string &source, int whichOne, const std::string &search, const std::string &replacement) |
Perform a single in-place replacement of search with replacement. More... | |
static bool | toBoolean (const std::string &s, bool &value) |
Converts a string to a boolean. More... | |
static bool | mixedAlphanumericComparator (const std::string &aa, const std::string &bb) |
A comparator for strings that sorts mixed numeric substrings properly. More... | |
|
static |
A comparator for strings that sorts mixed numeric substrings properly.
Compare two strings character by character until the first mismatch or one runs out of characters. Upon a mismatch, if both characters have digits, convert to floating-point numbers and choose the return value on whether aa's number is less than bb (true). Otherwise, the return value is true if aa's next character evaluates to less than bb's next character.
|
static |
Perform in-place replacement of search with replacement.
The returned integer is the number of occurrences of search in source that were replaced with replacement.
|
static |
Perform a single in-place replacement of search with replacement.
If whichOne is 0, no replacement is performed and std::string::npos is returned.
If whichOne is positive, the n-th occurrence (if it exists) – counting from the start of source – is replaced with replacement.
If whichOne is negative, the n-th occurrence (if it exists) – counting backward from the end of source – is replaced with replacement.
If no such occurrence is found, std::string::npos is returned. Otherwise, the location of the matching occurrence is returned.
|
static |
Converts a string to a boolean.
If the string s
can be converted to a boolean then the function returns true and value
is set to the converted value. The function will trim s
and convert it to lower case. The current acceptable values are: 1, t, true, yes, 0, f, false, no.