mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 09:21:18 +02:00
helpers: add isDigitWord() function
returns true if all chars of string parameter are digits
This commit is contained in:
@@ -1742,4 +1742,13 @@ std::string encodeUrl(std::string txt)
|
||||
return txt;
|
||||
}
|
||||
|
||||
bool isDigitWord(std::string str)
|
||||
{
|
||||
for (size_t i=0; i < str.size(); i++)
|
||||
if (!isdigit(str[i]))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -182,5 +182,7 @@ std::string decodeUrl(std::string url);
|
||||
bool getUrl(std::string &url, std::string &answer, const std::string userAgent = " ", unsigned int timeout = 60);
|
||||
bool downloadUrl(std::string url, std::string file, const std::string userAgent = " ", unsigned int timeout = 60);
|
||||
|
||||
bool isDigitWord(std::string str);
|
||||
|
||||
//
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user