diff options
author | kwolekr <kwolekr@minetest.net> | 2013-02-24 16:00:35 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2013-03-05 23:25:02 -0500 |
commit | ba78194636a9a498f6979cc21cd39399f23d658a (patch) | |
tree | 7cad8f0234fe4f7ff45807364b4c275296982805 /src/util | |
parent | bdbdeab0053d9ebbaffea17effeba777b710d390 (diff) | |
download | minetest-ba78194636a9a498f6979cc21cd39399f23d658a.tar.gz minetest-ba78194636a9a498f6979cc21cd39399f23d658a.tar.bz2 minetest-ba78194636a9a498f6979cc21cd39399f23d658a.zip |
Allow any character in formspec strings with escape char
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/string.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util/string.h b/src/util/string.h index 2f0264bd4..6c48adeb3 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -286,6 +286,22 @@ inline std::string wrap_rows(const std::string &from, u32 rowlen) return to; } +/* + Removes all \\ from a string that had been escaped (FormSpec strings) +*/ +inline std::string unescape_string(std::string &s) +{ + std::string res; + + for (size_t i = 0; i <= s.length(); i++) { + if (s[i] == '\\') + i++; + res += s[i]; + } + + return res; +} + std::string translatePassword(std::string playername, std::wstring password); size_t curl_write_data(char *ptr, size_t size, size_t nmemb, void *userdata); u32 readFlagString(std::string str, FlagDesc *flagdesc); |