diff options
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 |