19 os.reserve(str.size() + str.size() / 16);
21 for (std::string::const_iterator si = str.begin(); si != str.end(); ++si)
23 if (*si ==
'&') os +=
"&";
24 else if (*si ==
'<') os +=
"<";
25 else if (*si ==
'>') os +=
">";
26 else if (*si ==
'"') os +=
""";
34 size_t slen = strlen(str);
36 os.reserve(slen + slen / 16);
38 for (
const char* si = str; *si != 0; ++si)
40 if (*si ==
'&') os +=
"&";
41 else if (*si ==
'<') os +=
"<";
42 else if (*si ==
'>') os +=
">";
43 else if (*si ==
'"') os +=
""";
std::string escape_html(const std::string &str)
Escape characters for inclusion in HTML documents: replaces the characters <, >, & and " with HTML en...
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking