diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-28 22:09:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-28 22:09:45 +0300 |
commit | cd0883a1704c1b514b8b7317358949d43e230644 (patch) | |
tree | 08a0334c32dd61993e4557c34627a67b01313b36 /src | |
parent | 3d944b6d5ee981464f6eea4e9034d5aeb7b9423a (diff) | |
download | manaverse-cd0883a1704c1b514b8b7317358949d43e230644.tar.gz manaverse-cd0883a1704c1b514b8b7317358949d43e230644.tar.bz2 manaverse-cd0883a1704c1b514b8b7317358949d43e230644.tar.xz manaverse-cd0883a1704c1b514b8b7317358949d43e230644.zip |
Add function for add quotes and escape in text quotes.
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/stringutils.cpp | 6 | ||||
-rw-r--r-- | src/utils/stringutils.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index b2ac25875..66f61f168 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -996,6 +996,12 @@ std::string timeDiffToString(int timeDiff) return str; } +std::string escapeString(std::string str) +{ + replaceAll(str, "\"", "\\\""); + return "\"" + str + "\""; +} + #ifndef DYECMD void replaceItemLinks(std::string &msg) { diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index ab9290378..5b0249cc1 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -266,4 +266,6 @@ std::string timeDiffToString(int timeDiff); void replaceItemLinks(std::string &msg); +std::string escapeString(std::string str); + #endif // UTILS_STRINGUTILS_H |