summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2008-10-31 12:45:17 +0000
committerDavid Athay <ko2fan@gmail.com>2008-10-31 12:45:17 +0000
commit3ec0d0f152be4381dc843bc1ca99f8731c8fb366 (patch)
tree46bba84f40fcffdbede12931bbc92da4f764b4ed /src/utils
parent8ddad761280216252953bee9467e2787aaee484e (diff)
downloadmanaserv-3ec0d0f152be4381dc843bc1ca99f8731c8fb366.tar.gz
manaserv-3ec0d0f152be4381dc843bc1ca99f8731c8fb366.tar.bz2
manaserv-3ec0d0f152be4381dc843bc1ca99f8731c8fb366.tar.xz
manaserv-3ec0d0f152be4381dc843bc1ca99f8731c8fb366.zip
Changed command system to handle commands without template magic.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/string.cpp13
-rw-r--r--src/utils/string.hpp1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/string.cpp b/src/utils/string.cpp
index 059903c7..abd6eb88 100644
--- a/src/utils/string.cpp
+++ b/src/utils/string.cpp
@@ -29,3 +29,16 @@ std::string utils::toupper(std::string s)
std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) std::toupper);
return s;
}
+
+bool utils::isNumeric(const std::string &s)
+{
+ for (unsigned int i = 0; i < s.size(); ++i)
+ {
+ if (!isdigit(s[i]))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
diff --git a/src/utils/string.hpp b/src/utils/string.hpp
index ea70e72a..2adf31b6 100644
--- a/src/utils/string.hpp
+++ b/src/utils/string.hpp
@@ -27,6 +27,7 @@
namespace utils
{
std::string toupper(std::string);
+ bool isNumeric(const std::string &);
}
#endif // UTILS_STRING_HPP