Boost logo

Boost Users :

Subject: Re: [Boost-users] concat integer to wstring
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-11-12 17:06:04


On Thu, Nov 12, 2009 at 1:35 PM, Steven Watanabe <watanabesj_at_[hidden]>wrote:

> AMDG
>
>
> Lloyd wrote:
>
>> What is the best way to concatanate an integer to wstring?
>>
>> for example
>> ===========
>>
>> std::wstring ws=L"str";
>>
>> for(int i=0;i<10;++i)
>> {
>> cout<<ws+i;
>> }
>>
>> The output could be
>> str1
>> str2
>> ....
>> str9
>>
>
> ws + boost::lexical_cast<std::wstring>(i)?
>
> In Christ,
> Steven Watanabe
>
>
Or in this particular example:

cout << ws << i;

although I'm not sure if that's what the OP is really getting at.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net