rewrite http::trim in a simple way

This commit is contained in:
Benjamin Sergeant 2019-06-23 14:32:17 -07:00
parent f458cd297e
commit 92c2a7756d

View File

@ -15,10 +15,15 @@ namespace ix
{
std::string Http::trim(const std::string& str)
{
std::string out(str);
out.erase(std::remove(out.begin(), out.end(), ' '), out.end());
out.erase(std::remove(out.begin(), out.end(), '\r'), out.end());
out.erase(std::remove(out.begin(), out.end(), '\n'), out.end());
std::string out;
for (auto c : str)
{
if (c != ' ' && c != '\n' && c != '\r')
{
out += c;
}
}
return out;
}