diff options
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r-- | src/StringUtils.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index bc59730..564f307 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -3,7 +3,7 @@ namespace QuickMedia { template <typename T> - static void string_split_t(const std::string &str, const T &delimiter, StringSplitCallback callback_func, bool include_empty) { + static void string_split_t(const std::string_view str, const T &delimiter, StringSplitCallback callback_func, bool include_empty) { size_t index = 0; while(index < str.size()) { size_t new_index = str.find(delimiter, index); @@ -23,10 +23,18 @@ namespace QuickMedia { } void string_split(const std::string &str, const std::string &delimiter, StringSplitCallback callback_func, bool include_empty) { - string_split_t(str, delimiter, callback_func, include_empty); + string_split_t(std::string_view(str), delimiter, callback_func, include_empty); } void string_split(const std::string &str, char delimiter, StringSplitCallback callback_func, bool include_empty) { + string_split_t(std::string_view(str), delimiter, callback_func, include_empty); + } + + void string_split_view(const std::string_view str, const std::string &delimiter, StringSplitCallback callback_func, bool include_empty) { + string_split_t(str, delimiter, callback_func, include_empty); + } + + void string_split_view(const std::string_view str, char delimiter, StringSplitCallback callback_func, bool include_empty) { string_split_t(str, delimiter, callback_func, include_empty); } |