aboutsummaryrefslogtreecommitdiff
path: root/src/util/string.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/string.h')
-rw-r--r--src/util/string.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util/string.h b/src/util/string.h
index bed66417e..4aeea17db 100644
--- a/src/util/string.h
+++ b/src/util/string.h
@@ -27,6 +27,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <vector>
#include <sstream>
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+
struct FlagDesc {
const char *name;
u32 flag;
@@ -316,6 +319,17 @@ inline std::string unescape_string(std::string &s)
return res;
}
+inline bool is_number(const std::string& tocheck)
+{
+ std::string::const_iterator iter = tocheck.begin();
+
+ while (iter != tocheck.end() && std::isdigit(*iter)) {
+ ++iter;
+ }
+
+ return ((!tocheck.empty()) && (iter == tocheck.end()));
+}
+
std::string translatePassword(std::string playername, std::wstring password);
std::string urlencode(std::string str);
std::string urldecode(std::string str);