diff options
Diffstat (limited to 'src/utils/stringutils.h')
-rw-r--r-- | src/utils/stringutils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index cd80b60f..8e5f1102 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -121,6 +121,14 @@ std::string removeColors(std::string msg); int compareStrI(const std::string &a, const std::string &b); /** + * Returns whether a string starts with a given prefix. + */ +inline bool startsWith(const std::string &str, const char *prefix) +{ + return str.rfind(prefix, 0) == 0; +} + +/** * Tells wether the character is a word separator. */ bool isWordSeparator(char chr); |