diff options
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r-- | src/utils/stringutils.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index da3f8dd06..a54d9d5ab 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -697,3 +697,17 @@ std::string toStringPrint(const unsigned int val) str[99] = 0; return str; } + +bool isDigit(const std::string &str) +{ + if (str.empty()) + return false; + const size_t sz = str.size(); + for (size_t f = 0; f < sz; f ++) + { + const char &chr = str[f]; + if (chr < '0' || chr > '9') + return false; + } + return true; +} |