To search a string
Various functions are defined in here which allow you to search through a text in different ways.
More...
To search a string
Various functions are defined in here which allow you to search through a text in different ways.
◆ FindEndBracket()
static size_t kodi::tools::StringUtils::FindEndBracket |
( |
const std::string & | str, |
|
|
char | opener, |
|
|
char | closer, |
|
|
size_t | startPos = 0 ) |
|
inlinestatic |
Search a string for a given bracket and give its end position.
- Parameters
-
[in] | str | String to search within |
[in] | opener | Begin character to start search |
[in] | closer | End character to end search |
[in] | startPos | [opt] Position to start search in string, 0 as default to start from begin |
- Returns
- End position where found, -1 if failed
Example:
int ref, var;
ref = 11;
EXPECT_EQ(dateTime1.GetHour(), 12)
◆ FindNumber()
static int kodi::tools::StringUtils::FindNumber |
( |
const std::string & | strInput, |
|
|
const std::string & | strFind ) |
|
inlinestatic |
Search a text and return the number of parts found as a number.
- Parameters
-
[in] | strInput | Input string to search for |
[in] | strFind | String to search in input |
- Returns
- Amount how much the string is found
Example:
◆ FindWords()
static size_t kodi::tools::StringUtils::FindWords |
( |
const char * | str, |
|
|
const char * | wordLowerCase ) |
|
inlinestatic |
Search for a single word within a text.
- Parameters
-
[in] | str | String to search within |
[in] | wordLowerCase | Word as lowercase to search |
- Returns
- Position in string where word is found, -1 (std::string::npos) if not found
Example:
size_t ref, var;
ref = 5;
ref = -1;