summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-28 22:09:45 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-28 22:09:45 +0300
commitcd0883a1704c1b514b8b7317358949d43e230644 (patch)
tree08a0334c32dd61993e4557c34627a67b01313b36 /src
parent3d944b6d5ee981464f6eea4e9034d5aeb7b9423a (diff)
downloadmv-cd0883a1704c1b514b8b7317358949d43e230644.tar.gz
mv-cd0883a1704c1b514b8b7317358949d43e230644.tar.bz2
mv-cd0883a1704c1b514b8b7317358949d43e230644.tar.xz
mv-cd0883a1704c1b514b8b7317358949d43e230644.zip
Add function for add quotes and escape in text quotes.
Diffstat (limited to 'src')
-rw-r--r--src/utils/stringutils.cpp6
-rw-r--r--src/utils/stringutils.h2
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