Boost logo

Boost Users :

Subject: Re: [Boost-users] Concatenating int value to string ..??
From: Marcel Raad (raad_at_[hidden])
Date: 2013-11-04 06:27:07


Rahul Mathur <srivmuk <at> gmail.com> writes:

> TagName = TID + boost::lexical_cast<std::string>(TagID); // Should be as -
> Apple01

> TagInitial = TagName + boost::lexical_cast<std::string>(Value); // Should
> be as -> Apple01000

> int i = boost::lexical_cast<int>(TagInitial) + 1; // Should be as ->

> Apple01001

> TagUId = boost::lexical_cast<std::string>(i);

You cannot cast "Apple01000" to int. Try this:

// Should be as -> Apple01001

TagUId = TagName + boost::lexical_cast<std::string>(++Value);


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