-
Notifications
You must be signed in to change notification settings - Fork 0
Utility
Mister Mjir edited this page Dec 23, 2019
·
3 revisions
Provides utility methods for pTable under the namespace pTable.
STR_PARAM
-
const std::string &
, used for string parameters
Does nothing
Does nothing, used for Method
structs
Case-insensitive string check
bool checkstrnocase(STR_PARAM str1, STR_PARAM str2)
{
return ((str1.size() == str2.size()) &&
std::equal(str1.begin(), str1.end(), str2.begin(),
[](const char &c1, const char &c2) {return (c1 == c2 || std::toupper(c1) == std::toupper(c2));}
));
}
-
STR_PARAM str1
- A string to check
-
STR_PARAM str2
- Another string to check
A boolean holding true
if the strings passed the check or false
if they failed.
Seperates a string into a vector of substrings separated by whatever you want
std::vector<std::string> seperateString(std::string str, std::string sepStr)
{
std::vector<std::string> list;
std::string word = "";
for (auto letter : str)
{
std::string strLetter(1, letter);
if (strLetter.compare(sepStr) == 0)
{
list.push_back(word);
word = "";
}
else
word += letter;
}
list.push_back(word);
return list;
}
-
std::string str
- The string to seperate
-
std::string sepStr
- Tells how to seperate the string (ex. " " to seperate into words)
V 2.2.0