started adding more checks to the parser, some things settled, but mostly i have a lot more questions...

This commit is contained in:
Me
2022-07-31 04:20:04 +02:00
parent e5c2869172
commit 0cb49ffa5e
8 changed files with 205 additions and 159 deletions

View File

@@ -16,4 +16,28 @@ std::vector<std::string> split(std::string input, char delimiter)
return answer;
}
bool isNumeric(std::string str)
{
for (size_t i = 0; i < str.length(); i++)
{
if (std::isdigit(str[i]) == false)
return false;
}
return true;
}
bool isNumeric_btw(int low, int high, std::string str)
{
for (size_t i = 0; i < str.length(); i++)
{
if (std::isdigit(str[i]) == false)
return false;
}
int n = atoi(str.c_str());
if (n < low || n > high)
return false;
return true;
}