Defines functions for manipulating strings. More...
#include <assert.h>#include <string>#include <vector>#include <algorithm>Functions | |
| void | ToLower (std::string &str) |
| Transforms a string to lower case. | |
| void | ToUpper (std::string &str) |
| Transforms a string to upper case. | |
| bool | Match (char c, const char *match) |
| Matches a single character to a string of characters. | |
| bool | IsInteger (const std::string &str, int *val=NULL) |
| Determines if the given string is an integer. | |
| bool | IsWholeInteger (const std::string &str, int *val=NULL) |
| Determines if the given string is strictly an integer. | |
| bool | IsFloat (const std::string &str, float *val=NULL) |
| Determines if the given string is a float. | |
| bool | IsBoolean (const std::string &str, bool *val=NULL) |
| Determines if the given string is a boolean (0, 1, T, F, True, False, etc.). | |
| void | Replace (std::string &str, const char *match, char replace) |
| Replaces matching characters with a spacific single char. | |
| void | Replace (std::string &str, const char *match, const char *replace) |
| Replaces matching characters with a spacific string. | |
| std::string | Trim (const std::string &str, const char *what=" \t\n\r") |
| Trims leading and ending characters from a string. | |
| std::vector< std::string > | Split (const std::string &str, const char *delim=" ", bool skipDeliminator=true) |
| Splits a string into multiple substrings. | |
| size_t | Split (const std::string &str, const char *delim, std::vector< std::string > &result, bool skipDeliminator=true) |
| Splits a string into multiple substrings. | |
Defines functions for manipulating strings.
| bool IsBoolean | ( | const std::string & | str, | |
| bool * | val = NULL | |||
| ) |
Determines if the given string is a boolean (0, 1, T, F, True, False, etc.).
| [in] | str | the string to check. |
| [out] | val | the bool that the string represents. Defaults to NULL. |
| bool IsFloat | ( | const std::string & | str, | |
| float * | val = NULL | |||
| ) |
Determines if the given string is a float.
| [in] | str | the string to check. |
| [out] | val | the float that the string represents. Defaults to NULL. |
| bool IsInteger | ( | const std::string & | str, | |
| int * | val = NULL | |||
| ) |
Determines if the given string is an integer.
| [in] | str | the string to check. |
| [out] | val | the integer that the string represents. Defaults to NULL. |
| bool IsWholeInteger | ( | const std::string & | str, | |
| int * | val = NULL | |||
| ) |
Determines if the given string is strictly an integer.
| [in] | str | the string to check. |
| [out] | val | the integer that the string represents. Defaults to NULL. |
| bool Match | ( | char | c, | |
| const char * | match | |||
| ) | [inline] |
Matches a single character to a string of characters.
| [in] | c | the character to find a match for. |
| [in] | match | a string of characters to match c against. |
| void Replace | ( | std::string & | str, | |
| const char * | match, | |||
| const char * | replace | |||
| ) |
Replaces matching characters with a spacific string.
| [in] | str | the string to alter. |
| [in] | match | the characters to match. |
| [in] | replace | the character string to replace matches with. |
| void Replace | ( | std::string & | str, | |
| const char * | match, | |||
| char | replace | |||
| ) |
Replaces matching characters with a spacific single char.
| [in] | str | the string to alter. |
| [in] | match | the characters to match. |
| [in] | replace | the character to replace matches with. |
| size_t Split | ( | const std::string & | str, | |
| const char * | delim, | |||
| std::vector< std::string > & | result, | |||
| bool | skipDeliminator = true | |||
| ) |
Splits a string into multiple substrings.
| [in] | str | the string to split. |
| [in] | delim | a string of deliminating characters. Each individual character in the string is considered a deliminator. |
| [out] | result | stores the split substrings of str. |
| [in] | skipDeliminator | set to false to not have deliminators present in the output. Defaults to true. |
| std::vector<std::string> Split | ( | const std::string & | str, | |
| const char * | delim = " ", |
|||
| bool | skipDeliminator = true | |||
| ) |
Splits a string into multiple substrings.
| [in] | str | the string to split. |
| [in] | delim | a string of deliminating characters. Each individual character in the string is considered a deliminator. Defaults to " ". |
| [in] | skipDeliminator | set to false to not have deliminators present in the output. Defaults to true. |
| void ToLower | ( | std::string & | str | ) | [inline] |
Transforms a string to lower case.
| [in,out] | str | the string to make lower case. |
| void ToUpper | ( | std::string & | str | ) | [inline] |
Transforms a string to upper case.
| [in,out] | str | the string to make upper case. |
| std::string Trim | ( | const std::string & | str, | |
| const char * | what = " \t\n\r" | |||
| ) |
Trims leading and ending characters from a string.
| [in] | str | the string to trim. |
| [in] | what | the characters to be trimed. Defaults to space and newline characters. |
1.6.3