aboutsummaryrefslogtreecommitdiff
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index 111822e..56d746c 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -67,6 +67,11 @@ namespace QuickMedia {
return str.substr(start, end - start + 1);
}
+ bool string_starts_with(const std::string &str, const char *sub) {
+ size_t sub_len = strlen(sub);
+ return sub_len == 0 || (str.size() >= sub_len && memcmp(str.c_str(), sub, sub_len) == 0);
+ }
+
bool string_ends_with(const std::string &str, const std::string &ends_with_str) {
size_t ends_len = ends_with_str.size();
return ends_len == 0 || (str.size() >= ends_len && memcmp(&str[str.size() - ends_len], ends_with_str.data(), ends_len) == 0);