diff --git a/src/lib/util.hpp b/src/lib/util.hpp index 6c36c2959..961439894 100644 --- a/src/lib/util.hpp +++ b/src/lib/util.hpp @@ -142,6 +142,20 @@ namespace util { + /** check if string starts with a given prefix */ + inline bool + startsWith (string const& str, string const& prefix) + { + return 0 == str.rfind(prefix, 0); + } + + inline bool + startsWith (string const& str, const char* prefix) + { + return 0 == str.rfind(prefix, 0); + } + + /** shortcut for containment test on a map */ template inline bool