aboutsummaryrefslogtreecommitdiff
path: root/src/StringUtils.cpp
blob: deb4949989da16965cdd6c74a79f77e2dc3eb23b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
        }
    }
}