diff options
Diffstat (limited to 'src/utils/string.cpp')
-rw-r--r-- | src/utils/string.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/string.cpp b/src/utils/string.cpp index abd6eb88..79ca4dc6 100644 --- a/src/utils/string.cpp +++ b/src/utils/string.cpp @@ -23,6 +23,7 @@ #include <cctype> #include <algorithm> +#include <sstream> std::string utils::toupper(std::string s) { @@ -42,3 +43,14 @@ bool utils::isNumeric(const std::string &s) return true; } + +int utils::stringToInt(const std::string &s) +{ + int value; + std::stringstream str(s); + + // put the string into the int + str >> value; + + return value; +} |