From ebf7ea50193afe5a3d0968b87b4743eb1ee84025 Mon Sep 17 00:00:00 2001 From: sapier Date: Wed, 25 Jun 2014 19:04:47 +0200 Subject: Add formspec api versioning --- src/util/string.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/util') 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 #include +#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); -- cgit v1.2.3