26 lines
735 B
C++
26 lines
735 B
C++
#include "utils.hpp"
|
|
|
|
#include <boost/algorithm/string/replace.hpp>
|
|
|
|
mstch::citer mstch::first_not_ws(mstch::citer begin, mstch::citer end) {
|
|
for (auto it = begin; it != end; ++it)
|
|
if (*it != ' ') return it;
|
|
return end;
|
|
}
|
|
|
|
mstch::citer mstch::first_not_ws(mstch::criter begin, mstch::criter end) {
|
|
for (auto rit = begin; rit != end; ++rit)
|
|
if (*rit != ' ') return --(rit.base());
|
|
return --(end.base());
|
|
}
|
|
|
|
std::string mstch::html_escape(std::string str) {
|
|
boost::replace_all(str, "&", "&");
|
|
boost::replace_all(str, "'", "'");
|
|
boost::replace_all(str, "\"", """);
|
|
boost::replace_all(str, "<", "<");
|
|
boost::replace_all(str, ">", ">");
|
|
boost::replace_all(str, "/", "/");
|
|
return str;
|
|
}
|