Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

kuphryn

Concatenating: characters->string->vector (string) :: C++

This topic is 6158 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I would like to know how to concatenate characters into a string that is an element of a vector. For example: string dataTemp("today"); std::vector vecTemp; vecTemp.push_back(dataTemp); // I want to add characters into the tring element of vecTemp vecTemp[0] += " is Saturday." // Is that right? I would like vecTemp[0] to be "today is Saturday." Thanks, Kuphryn

Share this post


Link to post
Share on other sites
Advertisement
Okay.

I asked just to clarify that is the right way to get it working. Maybe there are better techniques.

Kuphryn

Share this post


Link to post
Share on other sites
Okay.

There are always better algorithms. It is a matter of experience. Maybe using a specifi STL algorithm is faster.

Kuphryn

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!