include string include wstring include limits include iostream include

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <string>
//#include <wstring>
#include <limits>
#include <iostream>
#include <vector>
#include <iostream>
#include <io.h>
#include <fcntl.h>
std::vector<std::wstring>
split(std::wstring a, std::wstring delim)
{
std::vector<std::wstring> result;
std::string::size_type found, current = 0;
while ((found = a.find(delim, current)) != std::string::npos) {
result.push_back(std::wstring(a.begin() + current, a.begin() + found - current));
current = found + 1;
}
//result.push_back(a, current, a.size() - current);
return result;
};
int main() {
_setmode(_fileno(stdout), _O_U16TEXT);
std::wstring boo(L"Я жеж не за тем жеж поехал сюда жеж а потому жеж что да");
std::wcout << boo;
return 0;
std::vector<std::wstring> result = split(boo, L"жеж");
for (int i=0; i< result.size(); i++) std::wcout << L'"' << result[i] << L'"' << "\n";
}