1void tokenize(string &str, char delim, vector<string> &out)
2{
3 size_t start;
4 size_t end = 0;
5
6 while ((start = str.find_first_not_of(delim, end)) != string::npos)
7 {
8 end = str.find(delim, start);
9 out.push_back(str.substr(start, end - start));
10 }
11}
12
13int main()
14{
15 string s="a;b;c";
16 char d=';';
17 vector<string> a;
18 tokenize(s,d,a);
19 for(auto it:a) cout<<it<<" ";
20
21 return 0;
22}