aboutsummaryrefslogtreecommitdiff
path: root/src/util/string.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/string.h')
-rw-r--r--src/util/string.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util/string.h b/src/util/string.h
index 5ffdc80d88..b26facc502 100644
--- a/src/util/string.h
+++ b/src/util/string.h
@@ -25,6 +25,14 @@
return str.substr(front, end - front + 1);
}
+[[nodiscard]] inline std::string RemovePrefix(const std::string& str, const std::string& prefix)
+{
+ if (str.substr(0, prefix.size()) == prefix) {
+ return str.substr(prefix.size());
+ }
+ return str;
+}
+
/**
* Join a list of items
*