|
| std::string | Repeat (const std::string &i_sString, size_t i_nTimes) |
| | Repeats the input string a specified number of times. More...
|
| |
| std::vector< std::string > | Split (const char *i_szString, size_t i_nLength, const char i_bDelimeter, const size_t i_nReserve=-1) |
| | Splits the input string into substrings based on the specified delimiter. More...
|
| |
| std::vector< std::string > | Split (const std::string &i_sString, const char i_bDelimeter, const size_t i_nReserve=-1) |
| | Splits the input string into substrings based on the specified delimiter. More...
|
| |
| std::string | Join (const std::vector< std::string > &i_asString, const std::string &i_sDelimeter) |
| | Joins the input vector of strings into a single string with the specified delimiter. More...
|
| |
| std::string | Join (const std::vector< std::string > &i_asString, const char i_bDelimeter) |
| |
| std::string & | Replace (std::string &i_sSource, const char i_bFind, const char i_bReplaceWith) |
| | Replaces all instances of a specific character in the source string with another character. More...
|
| |
| std::string | Replace (const std::string &i_sSource, const std::string &i_sFind, const std::string &i_sReplaceWith) |
| | Replaces all instances of a specific substring in the source string with another substring. More...
|
| |
| long long | ToInt64 (const std::string &i_sBuffer) |
| | Converts a string to a 64-bit integer. More...
|
| |
| unsigned long long | ToUInt64 (const std::string &i_sBuffer) |
| | Converts a string to an unsigned 64-bit integer. More...
|
| |
| int | ToInt (const std::string &i_sBuffer) |
| | Converts a string to an integer. More...
|
| |
| unsigned int | ToUInt (const std::string &i_sBuffer) |
| | Converts a string to an unsigned integer. More...
|
| |
| float | ToFloat (const std::string &i_stBuffer) |
| | Converts a string to a float. More...
|
| |
| double | ToDouble (const std::string &i_stBuffer) |
| | Converts a string to a double. More...
|
| |
| std::string | ToLowerCopy (const std::string &i_sBuffer) |
| | Creates a copy of the string and converts it to lower case. More...
|
| |
| void | ToLower (std::string &i_sBuffer) |
| | Converts the string to lower case. More...
|
| |
| std::string | ToUpperCopy (const std::string &i_sBuffer) |
| | Creates a copy of the string and converts it to upper case. More...
|
| |
| void | ToUpper (std::string &i_sBuffer) |
| | Converts the string to upper case. More...
|
| |
| bool | Contains (const std::string &i_sString, const std::string &i_sToFind, const bool i_fCaseSensetive=true) |
| | Checks if the string contains the substring. More...
|
| |
| size_t | Size (const char *i_szString, const size_t i_nMaxSize) |
| | Returns the size of the string, up to a maximum size. More...
|
| |
| void | Set (char *i_pDestination, const char *i_szString, const size_t i_nSize, size_t i_nMax) |
| | Copies a string to a destination buffer, up to a maximum size. More...
|
| |
| void | Set (char *i_pDestination, const char *i_szString, const size_t i_nMax) |
| | Copies a string to a destination buffer, up to a maximum size. More...
|
| |
| void | Set (char *i_pDestination, const std::string &i_sData, const size_t i_nMax) |
| | Copies a string to a destination buffer, up to a maximum size. More...
|
| |
| std::string | Get (char *i_pSource, const size_t i_nMaxSize) |
| | Returns a string copied from a source buffer, up to a maximum size. More...
|
| |
| size_t | Count (const char *i_szString, const size_t i_nSize, const char i_bDelimeter) |
| | Counts the number of a specific character in the string. More...
|
| |
| size_t | Count (const std::string &i_sString, const char i_bDelimeter) |
| | Counts the number of a specific character in the string. More...
|
| |
| template<typename T > |
| void | ToArray (T &i_pDestination, const char *i_szString, const size_t i_nSize) |
| | Copies a string to a destination array, up to a maximum size. More...
|
| |
| template<typename T > |
| void | ToArray (T &i_pDestination, const char *i_szString) |
| | Copies a string to a destination array. More...
|
| |
| template<typename T > |
| void | ToArray (T &i_pDestination, const std::string &i_sData) |
| | Converts a string to an array. More...
|
| |
| template<typename T > |
| std::string | FromArray (const T &i_pSource) |
| | Returns a string copied from a source array. More...
|
| |
| template<typename T , typename std::enable_if< std::is_arithmetic< T >::value >::type * = nullptr> |
| std::string | ToHex (T i_oValue) |
| | Converts a numeric value to a hex string. More...
|
| |
A namespace encapsulating a set of utility functions for string manipulation.
These utility functions provide a set of operations for string manipulation such as splitting, joining, replacing, converting case, etc.
Example
In this example, we demonstrate the use of the StringUtils namespace.
std::string str = "Hello, World!";
char buffer[50];
uint8_t byteData = 12;
std::cout << hexString << std::endl;
char arr[] = "Example array";
size_t arrSize = sizeof(arr)/sizeof(char);
std::cout << str << std::endl;
std::string str = "Example string";
const size_t size = 20;
char arr[size] = {};
std::cout << arr << std::endl;
size_t Size(const char *i_szString, const size_t i_nMaxSize)
Returns the size of the string, up to a maximum size.
Definition: StringUtils.h:332
float ToFloat(const std::string &i_stBuffer)
Converts a string to a float.
Definition: StringUtils.h:256
std::string ToLowerCopy(const std::string &i_sBuffer)
Creates a copy of the string and converts it to lower case.
Definition: StringUtils.h:274
std::vector< std::string > Split(const char *i_szString, size_t i_nLength, const char i_bDelimeter, const size_t i_nReserve=-1)
Splits the input string into substrings based on the specified delimiter.
Definition: StringUtils.h:113
size_t Count(const char *i_szString, const size_t i_nSize, const char i_bDelimeter)
Counts the number of a specific character in the string.
Definition: StringUtils.h:392
std::string Repeat(const std::string &i_sString, size_t i_nTimes)
Repeats the input string a specified number of times.
Definition: StringUtils.h:95
std::string ToHex(T i_oValue)
Converts a numeric value to a hex string.
Definition: StringUtils.h:449
std::string & Replace(std::string &i_sSource, const char i_bFind, const char i_bReplaceWith)
Replaces all instances of a specific character in the source string with another character.
Definition: StringUtils.h:181
std::string Get(char *i_pSource, const size_t i_nMaxSize)
Returns a string copied from a source buffer, up to a maximum size.
Definition: StringUtils.h:381
std::string ToUpperCopy(const std::string &i_sBuffer)
Creates a copy of the string and converts it to upper case.
Definition: StringUtils.h:296
void ToArray(T &i_pDestination, const char *i_szString, const size_t i_nSize)
Copies a string to a destination array, up to a maximum size.
Definition: StringUtils.h:411
std::string Join(const std::vector< std::string > &i_asString, const std::string &i_sDelimeter)
Joins the input vector of strings into a single string with the specified delimiter.
Definition: StringUtils.h:152
void Set(char *i_pDestination, const char *i_szString, const size_t i_nSize, size_t i_nMax)
Copies a string to a destination buffer, up to a maximum size.
Definition: StringUtils.h:348
bool Contains(const std::string &i_sString, const std::string &i_sToFind, const bool i_fCaseSensetive=true)
Checks if the string contains the substring.
Definition: StringUtils.h:320
int ToInt(const std::string &i_sBuffer)
Converts a string to an integer.
Definition: StringUtils.h:239
std::string FromArray(const T &i_pSource)
Returns a string copied from a source array.
Definition: StringUtils.h:439