Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- vector<string> strSplit(string s, string sep)
- {
- const size_t n = s.size();
- vector<string> splited;
- int st = 0, fin = n - 1;
- for (size_t i = 0; i <= n; i++)
- {
- if (sep.find(s[i]) != string::npos || i == n)
- {
- fin = i;
- string temp = string(s.begin() + st, s.begin() + fin);
- if (!temp.empty())
- splited.push_back(temp);
- st = i + 1;
- }
- }
- return splited;
- }
- int main()
- {
- vector<string> v = strSplit(" lol asd;;;;;;;;;;;;;0,.;fgh,,,.", "; .,");
- for (auto it : v)
- cerr << it << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement