aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/StringUtil.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-07 15:15:56 +0200
committerMax Kellermann <max@duempel.org>2014-08-07 16:08:02 +0200
commit59d38f876a22ef520c6b897a356e8fb8677481aa (patch)
treeac97bf3dfa23a4ae30a1d76375493f8815c649ff /src/util/StringUtil.cxx
parent5c5c6a965cc3af4c8e725c7c9cc377e80f728279 (diff)
downloadmpd-59d38f876a22ef520c6b897a356e8fb8677481aa.tar.gz
mpd-59d38f876a22ef520c6b897a356e8fb8677481aa.tar.xz
mpd-59d38f876a22ef520c6b897a356e8fb8677481aa.zip
util/StringUtil: add StripRight() overload with "end" argument
Diffstat (limited to '')
-rw-r--r--src/util/StringUtil.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util/StringUtil.cxx b/src/util/StringUtil.cxx
index 49a311a5f..bcade2b3b 100644
--- a/src/util/StringUtil.cxx
+++ b/src/util/StringUtil.cxx
@@ -35,6 +35,24 @@ StripLeft(const char *p)
return p;
}
+const char *
+StripLeft(const char *p, const char *end)
+{
+ while (p < end && IsWhitespaceOrNull(*p))
+ ++p;
+
+ return p;
+}
+
+const char *
+StripRight(const char *p, const char *end)
+{
+ while (end > p && IsWhitespaceOrNull(end[-1]))
+ --end;
+
+ return end;
+}
+
size_t
StripRight(const char *p, size_t length)
{