summaryrefslogtreecommitdiff
path: root/cpp/src/IceUtil/StringUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceUtil/StringUtil.cpp')
-rw-r--r--cpp/src/IceUtil/StringUtil.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp
index 99c4d759724..8965020fab8 100644
--- a/cpp/src/IceUtil/StringUtil.cpp
+++ b/cpp/src/IceUtil/StringUtil.cpp
@@ -1,6 +1,6 @@
// **********************************************************************
//
-// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
@@ -324,7 +324,6 @@ IceUtilInternal::splitString(const string& str, const string& delim, vector<stri
quoteChar = str[pos];
++pos;
}
- bool trim = true;
while(pos < length)
{
if(quoteChar != '\0' && str[pos] == '\\' && pos + 1 < length && str[pos + 1] == quoteChar)
@@ -333,7 +332,6 @@ IceUtilInternal::splitString(const string& str, const string& delim, vector<stri
}
else if(quoteChar != '\0' && str[pos] == quoteChar)
{
- trim = false;
++pos;
quoteChar = '\0';
break;
@@ -688,3 +686,39 @@ IceUtilInternal::lastErrorToString()
}
#endif
+
+string
+IceUtilInternal::toLower(const std::string& s)
+{
+ string result;
+ for(unsigned int i = 0; i < s.length(); ++ i)
+ {
+ result += tolower(static_cast<unsigned char>(s[i]));
+ }
+ return result;
+}
+
+string
+IceUtilInternal::toUpper(const std::string& s)
+{
+ string result;
+ for(unsigned int i = 0; i < s.length(); ++ i)
+ {
+ result += toupper(static_cast<unsigned char>(s[i]));
+ }
+ return result;
+}
+
+string
+IceUtilInternal::removeWhitespace(const std::string& s)
+{
+ string result;
+ for(unsigned int i = 0; i < s.length(); ++ i)
+ {
+ if(!isspace(static_cast<unsigned char>(s[i])))
+ {
+ result += s[i];
+ }
+ }
+ return result;
+}