aboutsummaryrefslogtreecommitdiff
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
new file mode 100644
index 0000000..deb4949
--- /dev/null
+++ b/src/StringUtils.cpp
@@ -0,0 +1,17 @@
+#include "../include/StringUtils.hpp"
+
+namespace QuickMedia {
+ void string_split(const std::string &str, char delimiter, StringSplitCallback callback_func) {
+ size_t index = 0;
+ while(true) {
+ size_t new_index = str.find(delimiter, index);
+ if(new_index == std::string::npos)
+ break;
+
+ if(!callback_func(str.data() + index, new_index - index))
+ break;
+
+ index = new_index + 1;
+ }
+ }
+} \ No newline at end of file