summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-08 13:46:07 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-08 13:46:07 +0300
commit9e1c8b7ab5db33f544305c3b160ca65b6972370f (patch)
tree1bd1f627d3d58a874953149de001a770f7d9ea9e /src/utils/stringutils.cpp
parent857da1b7b4e0a2523947b6ec82746a559543f329 (diff)
downloadmanaplus-9e1c8b7ab5db33f544305c3b160ca65b6972370f.tar.gz
manaplus-9e1c8b7ab5db33f544305c3b160ca65b6972370f.tar.bz2
manaplus-9e1c8b7ab5db33f544305c3b160ca65b6972370f.tar.xz
manaplus-9e1c8b7ab5db33f544305c3b160ca65b6972370f.zip
add ability to show stats from items.xml like strings.
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp14
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;
+}