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

kuphryn

Senior member
Jan 7, 2001
400
0
0
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<string> 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
 

Turkey

Senior member
Jan 10, 2000
839
0
0
You are correct!!! </Ed McMahon voice>

That, or use the append method

data[0].append(" is saturday");

At least, I think there's an append method.