diff options
| author | Adam <Adam@anope.org> | 2011-04-29 21:12:49 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-05-16 04:10:15 -0400 |
| commit | b999c6ca53d6b1dfd54688d21718293858f6bcc7 (patch) | |
| tree | 1090a9d538010eb4026daac7d4b1dbd131635044 /include/anope.h | |
| parent | 583954d3a1db658281a9afb7b7dd6773726c8c11 (diff) | |
Expand more on m_alias and changed some std::string usage in sockets.cpp to use Anope::string
Diffstat (limited to 'include/anope.h')
| -rw-r--r-- | include/anope.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/anope.h b/include/anope.h index b23b68481..0e25bbb93 100644 --- a/include/anope.h +++ b/include/anope.h @@ -174,6 +174,17 @@ namespace Anope inline void erase(size_type pos = 0, size_type n = std::string::npos) { this->_string.erase(pos, n); } /** + * Trim leading and trailing white spaces from the string. + */ + inline void trim() + { + while (!this->_string.empty() && isspace(this->_string[0])) + this->_string.erase(this->_string.begin()); + while (!this->_string.empty() && isspace(this->_string[this->_string.length() - 1])) + this->_string.erase(this->_string.length() - 1); + } + + /** * Clears the string. */ inline void clear() { this->_string.clear(); } |
