Collection of utility functions to work on or with strings.
- See also
- ImFusionCoreString
|
| void | replaceAll (std::string &str, std::string_view from, std::string_view to) |
| | Replaces all occurrences of from in str with to.
|
| |
| std::string | replaceAllCopy (std::string_view str, std::string_view from, std::string_view to) |
| | Returns a copy of str with all occurrences of replaced by to.
|
| |
| void | removeLetters (std::string &str) |
| | Removes all alphabetic characters in place.
|
| |
| std::string | fromDurationMs (double durationInMilliseconds) |
| | Convert a duration in milliseconds to a human-readable string with days, hours, minutes where applicable.
|
| |
| std::string | fromDouble (double value, std::optional< int > maxDecimals=std::nullopt) |
| | Convert a double to a string representation, with a limited max number of decimals.
|
| |
|
std::string | ordinal (int num) |
| | Convert an integer number to its ordinal number string representation, such as "1st", "2nd", "3rd", "4th", etc.
|
| |
| int | naturalCompare (const std::string &str1, const std::string &str2) |
| | Compare two strings according to the natural sort order.
|
| |
| int | levenshteinDistance (const std::string &source, const std::string &target, CaseSensitivity sensitivity=CaseSensitive) |
| | Computes the Levenshtein distance (also known as Edit distance) between two strings.
|
| |
|
| bool | iEquals (std::string_view a, std::string_view b) |
| | Compares both strings case insensitive, returns true if they are the same (case insensitive)
|
| |
|
bool | startsWith (std::string_view str, std::string_view prefix) |
| | Checks whether the input string has the given prefix.
|
| |
| bool | iStartsWith (std::string_view str, std::string_view prefix) |
| | Checks whether the input string has the given prefix, ignoring case (case-insensitive).
|
| |
|
bool | endsWith (std::string_view str, std::string_view suffix) |
| | Checks whether the input string has the given suffix.
|
| |
| bool | iEndsWith (std::string_view str, std::string_view suffix) |
| | Checks whether the input string has the given suffix, ignoring case (case-insensitive).
|
| |
|
bool | contains (std::string_view str, std::string_view substring) |
| | Checks whether the input string contains the given substring.
|
| |
| bool | iContains (std::string_view str, std::string_view substring) |
| | Checks whether the input string contains the given substring, ignoring case (case-insensitive).
|
| |
|
bool | containsAnyOf (std::string_view str, std::string_view characters) |
| | Checks whether the input string contains any of the given characters.
|
| |
| bool | iContainsAnyOf (std::string_view str, std::string_view characters) |
| | Checks whether the input string contains any of the given characters, ignoring case (case-insensitive).
|
| |
| bool | matchesPattern (std::string_view str, std::string_view pattern) |
| | Checks if a string matches a pattern containing * and ? wildcards.
|
| |
|
| template<typename Container, typename UnaryOperation> |
| std::string | join (const Container &list, UnaryOperation unary_op, const std::string &sep) |
| | Joins the list to a string and separates the elements with sep.
|
| |
| template<typename C> |
| std::string | join (const C &list, const std::string &sep) |
| | Joins the list to a string and separates the elements with sep.
|
| |
|
template<typename T> |
| std::string | join (const std::initializer_list< T > &list, const std::string &sep) |
| | Helper methods for initializer lists.
|
| |
| std::string | joinNonEmpty (const std::vector< std::string > &vec, const std::string &sep="") |
| | Joins a vector of strings together, interposing a separator (empty by default).
|
| |
| std::vector< std::string > | split (std::string_view input, std::string_view separator, Flags< SplitOptions > splitOptions=SplitOptions::Default) |
| | Splits input into substrings based on the given separator and splitOptions.
|
| |
| std::vector< std::string_view > | splitRef (std::string_view input, std::string_view separator, Flags< SplitOptions > splitOptions=SplitOptions::Default) |
| | Splits input into substring views based on the given separator and splitOptions.
|
| |
| std::vector< std::string > | splitCamelCase (const std::string &input) |
| | Split camel case string into words.
|
| |