summaryrefslogtreecommitdiff
path: root/lib/common/Utils.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-11-26 23:32:29 +0000
committerChris Wilson <chris+github@qwirx.com>2015-12-12 23:04:21 +0000
commitc459a8b5c88d82c44874edc6933c53a2b2a422d1 (patch)
tree46ee342430ed05f3235d8b2a50dbec85d15e4762 /lib/common/Utils.h
parentb692c4737d305d52289fb0d4d09cb18e998d0e22 (diff)
Add some little string functions to Utils.cpp.
These functions check whether the beginning and end of a std::string match a supplied prefix or suffix, and remove that prefix or suffix, returning the remaining part. They are almost but not entirely trivial, and giving them names makes the code that uses them much more readable.
Diffstat (limited to 'lib/common/Utils.h')
-rw-r--r--lib/common/Utils.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/common/Utils.h b/lib/common/Utils.h
index 3a5f0eb5..d306ce1c 100644
--- a/lib/common/Utils.h
+++ b/lib/common/Utils.h
@@ -18,6 +18,10 @@
std::string GetBoxBackupVersion();
void SplitString(std::string String, char SplitOn, std::vector<std::string> &rOutput);
+bool StartsWith(const std::string& prefix, const std::string& haystack);
+bool EndsWith(const std::string& prefix, const std::string& haystack);
+std::string RemovePrefix(const std::string& prefix, const std::string& haystack);
+std::string RemoveSuffix(const std::string& suffix, const std::string& haystack);
void DumpStackBacktrace();