aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/DivideString.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/DivideString.cxx')
-rw-r--r--src/util/DivideString.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/util/DivideString.cxx b/src/util/DivideString.cxx
index d30dfaa16..f781d141f 100644
--- a/src/util/DivideString.cxx
+++ b/src/util/DivideString.cxx
@@ -18,10 +18,11 @@
*/
#include "DivideString.hxx"
+#include "StringUtil.hxx"
#include <string.h>
-DivideString::DivideString(const char *s, char separator)
+DivideString::DivideString(const char *s, char separator, bool strip)
:first(nullptr)
{
const char *x = strchr(s, separator);
@@ -31,6 +32,16 @@ DivideString::DivideString(const char *s, char separator)
size_t length = x - s;
second = x + 1;
+ if (strip)
+ second = StripLeft(second);
+
+ if (strip) {
+ const char *end = s + length;
+ s = StripLeft(s);
+ end = StripRight(s, end);
+ length = end - s;
+ }
+
first = new char[length + 1];
memcpy(first, s, length);
first[length] = 0;