|
tgbotxx 1.2.9.2
Telegram Bot C++ Library
|
Namespace contains useful string related utility functions. More...
Functions | |
| template<typename T , typename D > | |
| static std::string | join (std::span< T > con, const D &delim) |
| Form a string from a container with a delimiter. | |
| template<typename T , typename D > | |
| static std::string | join (const std::vector< T > &con, const D &delim) |
| static std::vector< std::string > | split (const std::string &str, char delim) |
| Split a string by delimiter. | |
| static std::string | toLowerCopy (std::string str) |
| Lowercase a string. | |
| static void | toLower (std::string &str) |
| Lowercase original string str. | |
| static std::string | toUpperCopy (std::string str) |
| Uppercase a string. | |
| static void | toUpper (std::string &str) |
| Uppercase original string str. | |
| static void | ltrim (std::string &str) |
| Left trim a string from start (in place) | |
| static void | rtrim (std::string &str) |
| Right trim a string from end (in place) | |
| static void | trim (std::string &str) |
| Left and right trim a string (from beginning and end) (in place) | |
| static std::string | ltrimCopy (std::string s) |
| Left trim a string from start (copy) | |
| static std::string | rtrimCopy (std::string s) |
| Right trim a string from end (copy) | |
| static std::string | trimCopy (std::string s) |
| Left and Right trim a string from start and end (copy) | |
| static bool | startsWith (const std::string &str, const std::string &prefix, bool ignoreCase=false) |
| Returns true if str starts with prefix. | |
| static bool | endsWith (const std::string &str, const std::string &suffix, bool ignoreCase=false) |
| Returns true if str ends with suffix. | |
| static void | replace (std::string &str, const std::string &search, const std::string &replace) |
| static std::string | replaceCopy (std::string str, const std::string &search, const std::string &replace) |
| template<typename T > | |
| static T | to (const std::string &str) |
| static std::string | random (std::size_t length) |
| Returns a random string of length characters. | |
Namespace contains useful string related utility functions.
|
static |
Returns true if str ends with suffix.
| str | string to check |
| suffix | suffix to check if str ends with it |
| ignoreCase | Case sensitivity, default: false |
Definition at line 144 of file StringUtils.hpp.
|
static |
Definition at line 32 of file StringUtils.hpp.
Form a string from a container with a delimiter.
| con | Container of T elements |
| delim | Text to put between each element T Example: array = [1,2,3] StringUtils::join(array, ",") -> "1,2,3" |
Definition at line 18 of file StringUtils.hpp.
Left trim a string from start (in place)
| str | string to trim from the left |
Definition at line 79 of file StringUtils.hpp.
|
static |
Left trim a string from start (copy)
| s | string to trim from the left |
Definition at line 105 of file StringUtils.hpp.
|
static |
Returns a random string of length characters.
Definition at line 194 of file StringUtils.hpp.
|
static |
Replaces a token within a string with another string
| str | String that contains tokens to replace |
| search | Token to replace |
| replace | New value to replace token with |
Definition at line 156 of file StringUtils.hpp.
|
static |
Replaces a token within a string with another string and return a new copy
| str | String that contains tokens to replace |
| search | Token to replace |
| replace | New value to replace token with |
Definition at line 171 of file StringUtils.hpp.
Right trim a string from end (in place)
| str | string to trim from the right |
Definition at line 87 of file StringUtils.hpp.
|
static |
Right trim a string from end (copy)
| s | string to trim from the right |
Definition at line 113 of file StringUtils.hpp.
|
static |
Split a string by delimiter.
| str | String to split |
| delim | Split by delimiter |
Definition at line 40 of file StringUtils.hpp.
|
static |
Returns true if str starts with prefix.
| str | string to check |
| prefix | prefix to check if str starts with it |
| ignoreCase | Case sensitivity, default: false |
Definition at line 131 of file StringUtils.hpp.
Convert a string to T type
| T | desired type |
| str | string to convert |
Definition at line 186 of file StringUtils.hpp.
Lowercase original string str.
| str | string to lowercase |
Definition at line 59 of file StringUtils.hpp.
|
static |
Lowercase a string.
| str | string to lowercase |
Definition at line 52 of file StringUtils.hpp.
Uppercase original string str.
| str | string to uppercase |
Definition at line 73 of file StringUtils.hpp.
|
static |
Uppercase a string.
| str | string to uppercase |
Definition at line 66 of file StringUtils.hpp.
Left and right trim a string (from beginning and end) (in place)
| str | string to trim from the left and right |
Definition at line 97 of file StringUtils.hpp.
|
static |
Left and Right trim a string from start and end (copy)
| s | string to trim from the left and right |
Definition at line 121 of file StringUtils.hpp.