MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / escape

Function escape

core/stringconversion.cpp:90–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void escape(std::string &str, char toEscape)
91{
92 //cannot escape string that contains the escaped sequence already because the mapping is not one-to-one anymore
93 std::string unescaped = str;
94 unescape(unescaped, toEscape);
95 if (unescaped != str)
96 {
97 throw std::exception();
98 }
99 //
100 size_t pos;
101 std::string escaped = escapeCharacter(toEscape);
102 while ((pos = str.find(toEscape)) != std::string::npos)
103 {
104 str = str.replace(pos, 1, escaped);
105 }
106
107}
108void unescape(std::string &str, char toUnescape)
109{
110

Callers

nothing calls this directly

Calls 2

unescapeFunction · 0.85
escapeCharacterFunction · 0.85

Tested by

no test coverage detected