This question shows how to split a string
into a vector
using a single character delimeter.
Question: Right way to split an std::string into a vector
However, applying this technique to wstring
isn't as easy as I thought. Therefore this is definitely not a duplicate at all!
wstringstream stringStream(str);
istream_iterator<wstring> begin(stringStream);
istream_iterator<wstring> end;
List = vector<wstring>(begin, end);
copy(List.begin(), List.end(), ostream_iterator<wstring>(cout, ";"));
The second line can't be compiled using VS2015. And using istream_iterator<wstring, wchar_t>
causes a compile error in iterator.h
.
How can I split a std::wstring
into a std::vector
that is separated by ";"
?