aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/StringUtil.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/StringUtil.cxx')
-rw-r--r--src/util/StringUtil.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util/StringUtil.cxx b/src/util/StringUtil.cxx
index bb454e904..b9c99eb4a 100644
--- a/src/util/StringUtil.cxx
+++ b/src/util/StringUtil.cxx
@@ -18,6 +18,7 @@
*/
#include "StringUtil.hxx"
+#include "StringAPI.hxx"
#include "CharUtil.hxx"
#include "ASCII.hxx"
@@ -45,6 +46,21 @@ StringEndsWith(const char *haystack, const char *needle)
}
const char *
+StringAfterPrefix(const char *string, const char *prefix)
+{
+#if !CLANG_CHECK_VERSION(3,6)
+ /* disabled on clang due to -Wtautological-pointer-compare */
+ assert(string != nullptr);
+ assert(prefix != nullptr);
+#endif
+
+ size_t prefix_length = strlen(prefix);
+ return StringIsEqual(string, prefix, prefix_length)
+ ? string + prefix_length
+ : nullptr;
+}
+
+const char *
FindStringSuffix(const char *p, const char *suffix)
{
const size_t p_length = strlen(p);