summaryrefslogtreecommitdiff
path: root/cpp/src/IceUtil/StringUtil.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2008-02-14 16:22:39 +0800
committerMatthew Newhook <matthew@zeroc.com>2008-02-14 16:22:39 +0800
commit294ec25fda6e3785c54970d274b860b1ca837955 (patch)
tree26e5d1987ffdfde7bbacb87fdfb7b96bbef998e9 /cpp/src/IceUtil/StringUtil.cpp
parentMerge branch 'bug2435' (diff)
downloadice-294ec25fda6e3785c54970d274b860b1ca837955.tar.bz2
ice-294ec25fda6e3785c54970d274b860b1ca837955.tar.xz
ice-294ec25fda6e3785c54970d274b860b1ca837955.zip
merged bug2615
Diffstat (limited to 'cpp/src/IceUtil/StringUtil.cpp')
-rw-r--r--cpp/src/IceUtil/StringUtil.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp
index 62bd9e1f44d..e087e5586dc 100644
--- a/cpp/src/IceUtil/StringUtil.cpp
+++ b/cpp/src/IceUtil/StringUtil.cpp
@@ -364,6 +364,23 @@ IceUtilInternal::splitString(const string& str, const string& delim, vector<stri
return true;
}
+//
+// Trim white space (" \t\r\n")
+//
+string
+IceUtilInternal::trim(const string& s)
+{
+ static const string delim = " \t\r\n";
+ string::size_type beg = s.find_first_not_of(delim);
+ if(beg == string::npos)
+ {
+ return "";
+ }
+ else
+ {
+ return s.substr(beg, s.find_last_not_of(delim) - beg + 1);
+ }
+}
//
// If a single or double quotation mark is found at the start position,