diff options
Diffstat (limited to 'cppe/src/IceE/StringUtil.cpp')
-rw-r--r-- | cppe/src/IceE/StringUtil.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cppe/src/IceE/StringUtil.cpp b/cppe/src/IceE/StringUtil.cpp index 8ea102ad407..1a797592071 100644 --- a/cppe/src/IceE/StringUtil.cpp +++ b/cppe/src/IceE/StringUtil.cpp @@ -309,6 +309,22 @@ IceUtil::unescapeString(const string& s, string::size_type start, string::size_t } // +// Trim white space (" \t\r\n") +// +string +IceUtil::trim(const string& s) +{ + const string delim = " \t\r\n"; + if(s.length() != 0) + { + string::size_type beg = s.find_first_not_of(delim); + string::size_type end = s.find_last_not_of(delim); + return s.substr(beg, end - beg + 1); + } + return s; +} + +// // If a single or double quotation mark is found at the start position, // then the position of the matching closing quote is returned. If no // quotation mark is found at the start position, then 0 is returned. |