From 59d38f876a22ef520c6b897a356e8fb8677481aa Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 7 Aug 2014 15:15:56 +0200 Subject: util/StringUtil: add StripRight() overload with "end" argument --- src/util/StringUtil.hxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/util/StringUtil.hxx') 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(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(StripRight((const char *)p, + (const char *)end)); +} + /** * Determine the string's length as if it was stripped on the right * side. -- cgit v1.2.3