diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-12-07 18:10:12 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2019-12-07 18:10:12 +0100 |
commit | 3364e8c6291907ea88e45314c5add9624b81c110 (patch) | |
tree | f832ea211c8c4fc7f132ba68c8c0c32bfce3e3bb /src/StringUtils.cpp | |
parent | 623cfeb9de7ff4bcc710b5a4e41cc354bb2e3f0c (diff) |
Add support for viewing videos/gifs on image boards (4chan)
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r-- | src/StringUtils.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index 16d3b48..981b227 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -1,4 +1,5 @@ #include "../include/StringUtils.hpp" +#include <string.h> namespace QuickMedia { void string_split(const std::string &str, char delimiter, StringSplitCallback callback_func) { @@ -47,4 +48,9 @@ namespace QuickMedia { return str.substr(start, end - start + 1); } + + 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); + } }
\ No newline at end of file |