From ba78194636a9a498f6979cc21cd39399f23d658a Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sun, 24 Feb 2013 16:00:35 -0500 Subject: Allow any character in formspec strings with escape char --- src/strfnd.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/strfnd.h') diff --git a/src/strfnd.h b/src/strfnd.h index d28aa73b2..4a72edf3c 100644 --- a/src/strfnd.h +++ b/src/strfnd.h @@ -65,6 +65,25 @@ public: //std::cout<<"palautus=\""<= tek.size()) + return ""; + + realp = p; + do { + n = tek.find(plop, p); + if (n == std::string::npos || plop == "") + n = tek.length(); + p = n + plop.length(); + } while (n > 0 && tek[n - 1] == '\\'); + + return tek.substr(realp, n - realp); + } + void skip_over(std::string chars){ while(p < tek.size()){ bool is = false; @@ -128,6 +147,24 @@ public: //std::cout<<"palautus=\""<= tek.size()) + return L""; + + realp = p; + do { + n = tek.find(plop, p); + if (n == std::wstring::npos || plop == L"") + n = tek.length(); + p = n + plop.length(); + } while (n > 0 && tek[n - 1] == '\\'); + + return tek.substr(realp, n - realp); + } + bool atend(){ if(p>=tek.size()) return true; return false; -- cgit v1.2.3