aboutsummaryrefslogtreecommitdiff
path: root/src/util/string.h
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-06-25 19:04:47 +0200
committersapier <Sapier at GMX dot net>2014-06-29 12:13:55 +0200
commitebf7ea50193afe5a3d0968b87b4743eb1ee84025 (patch)
tree53470e3b12911de9d7aed0acd0c1d96cbd006158 /src/util/string.h
parent1367895ae226b4bbdc152274329c789cb5738022 (diff)
downloadminetest-ebf7ea50193afe5a3d0968b87b4743eb1ee84025.tar.gz
minetest-ebf7ea50193afe5a3d0968b87b4743eb1ee84025.tar.bz2
minetest-ebf7ea50193afe5a3d0968b87b4743eb1ee84025.zip
Add formspec api versioning
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);