summaryrefslogtreecommitdiff
path: root/include/anope.h
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-02-11 19:25:44 -0500
committerAdam <Adam@anope.org>2014-02-11 19:25:44 -0500
commit96fc940af7f20001b290cc65a76d0afb88a6160c (patch)
treea2639b598686fd9403429cd8e734b2b8563b5795 /include/anope.h
parent8c8e6d464a28079531dfd2c4743e14beed611915 (diff)
Only trim newlines and carriage returns in BufferedSocket::GetLine
Diffstat (limited to 'include/anope.h')
-rw-r--r--include/anope.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/anope.h b/include/anope.h
index 354c0bda5..28bc50512 100644
--- a/include/anope.h
+++ b/include/anope.h
@@ -159,24 +159,24 @@ namespace Anope
* Trim leading and trailing white spaces from the string.
*/
- inline string& ltrim()
+ inline string& ltrim(const Anope::string &what = " \t\r\n")
{
- while (!this->_string.empty() && isspace(this->_string[0]))
+ while (!this->_string.empty() && what.find(this->_string[0]) != Anope::string::npos)
this->_string.erase(this->_string.begin());
return *this;
}
- inline string& rtrim()
+ inline string& rtrim(const Anope::string &what = " \t\r\n")
{
- while (!this->_string.empty() && isspace(this->_string[this->_string.length() - 1]))
+ while (!this->_string.empty() && what.find(this->_string[this->_string.length() - 1]) != Anope::string::npos)
this->_string.erase(this->_string.length() - 1);
return *this;
}
- inline string& trim()
+ inline string& trim(const Anope::string &what = " \t\r\n")
{
- this->ltrim();
- this->rtrim();
+ this->ltrim(what);
+ this->rtrim(what);
return *this;
}