I want to convert an integer value (int) to std::wstring. What is the best way to do this? I'm developing for windows phone so I would rather avoid using external libraries (such as boost::lexical_cast). I'm looking for something simple, preferably one line of code that just assigns the int to the wstring.
Any help would be appreciated.
Are you looking for std::to_wstring
std::wstring to_wstring( int value ); (since C++11)
Converts a signed decimal integer to a wide string with the same content as what std::swprintf(buf, sz, L"%d", value) would produce for sufficiently large buf.
size_t myInteger = 10;
std::wostringstream myStringStream;
myStringStream<< L"myText" << myInteger;
std::wstring concatenatedStr = myStringStream.str();
Conacatenating number to wstring.
In old C++ 98 Visual Studio 2010.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With