Re: [Boost-users] convert std::string to std::wstring

19 Jun
2008
19 Jun
'08
3:29 a.m.
I have searched a lot in every place what is the best way to convert a string to a wstring (and may be vice versa). But til now I don`t got any results. Can anyone give me an hint what is the best way to do that (also good performance?)? maybe there is something available to do that? may be also with some examples.
Use member function assign(). Ex. // wstring ->string wstring ws(L"this is a wstring"); string s; s.assign(ws.begin(), ws.end());// now s = "this is a wstring"; // wstring ->string string s("this is a wstring"); wstring ws; ws.assign(s.begin(), s.end());// now ws = L"this is a wstring";
6093
Age (days ago)
6093
Last active (days ago)
0 comments
1 participants
participants (1)
-
Tan, Tom (Shanghai)