rewrite http::trim in a simple way
This commit is contained in:
parent
f458cd297e
commit
92c2a7756d
@ -15,10 +15,15 @@ namespace ix
|
|||||||
{
|
{
|
||||||
std::string Http::trim(const std::string& str)
|
std::string Http::trim(const std::string& str)
|
||||||
{
|
{
|
||||||
std::string out(str);
|
std::string out;
|
||||||
out.erase(std::remove(out.begin(), out.end(), ' '), out.end());
|
for (auto c : str)
|
||||||
out.erase(std::remove(out.begin(), out.end(), '\r'), out.end());
|
{
|
||||||
out.erase(std::remove(out.begin(), out.end(), '\n'), out.end());
|
if (c != ' ' && c != '\n' && c != '\r')
|
||||||
|
{
|
||||||
|
out += c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user