aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/StringUtil.hxx
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.hxx
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.hxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/util/StringUtil.hxx b/src/util/StringUtil.hxx
index abed3b45b..9beda5441 100644
--- a/src/util/StringUtil.hxx
+++ b/src/util/StringUtil.hxx
@@ -39,6 +39,28 @@ StripLeft(char *p)
return const_cast<char *>(StripLeft((const char *)p));
}
+gcc_pure
+const char *
+StripLeft(const char *p, const char *end);
+
+/**
+ * Determine the string's end as if it was stripped on the right side.
+ */
+gcc_pure
+const char *
+StripRight(const char *p, const char *end);
+
+/**
+ * Determine the string's end as if it was stripped on the right side.
+ */
+gcc_pure
+static inline char *
+StripRight(char *p, char *end)
+{
+ return const_cast<char *>(StripRight((const char *)p,
+ (const char *)end));
+}
+
/**
* Determine the string's length as if it was stripped on the right
* side.