diff options
author | Oleg Morozenkov <o.morozenkov@corp.mail.ru> | 2022-11-01 19:43:42 +0300 |
---|---|---|
committer | Oleg Morozenkov <o.morozenkov@corp.mail.ru> | 2022-11-01 19:43:42 +0300 |
commit | e96d3a3d4f023dc0d5d4e60fb8efb5a40ce7a71d (patch) | |
tree | f57f44b1448204120229bd83f3654b32e3df79ed /src/tools/StringTools.cpp | |
parent | 30136601c6755e5d7c2174ebd4ed49595e10a54b (diff) | |
parent | 7abb2509b87ef1344da97ae734211715f291cfa2 (diff) |
Merge remote-tracking branch 'llnulldisk/master' into merge-228
Diffstat (limited to 'src/tools/StringTools.cpp')
-rw-r--r-- | src/tools/StringTools.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/StringTools.cpp b/src/tools/StringTools.cpp index 653047c..3e5e6c4 100644 --- a/src/tools/StringTools.cpp +++ b/src/tools/StringTools.cpp @@ -101,4 +101,22 @@ string urlDecode(const string& value) { return result; } +std::string escapeJsonString(const std::string& value) { + string result; + + for (const char& c : value) { + switch (c) { + case '"': + case '\\': + case '/': + result += '\\'; + break; + } + + result += c; + } + + return result; +} + } |