Replace a character in a string.

V

Venkat

Greetings,

I got a string like this str = {1234-4543-6453-ACBD-AFEB} now i need to have
an output like str = 1234-4543-6453-ACBD-AFEB, basically i want to remove
the characters
'{' and '}'.

here is the code....

vector<string> Temp;

//Fill the elements in Temp
........................
.........................

//Read the elements from Temp

for (int l = 0; l < Temp.size(); ++l)
{
std::string str= Temp[l].c_str();

}


Now str outputs the values with character '{' and '}' i need it to output
values without these characters.


Pl Help.


Regards,
Venkat
 
L

lallous

Venkat said:
Greetings,

I got a string like this str = {1234-4543-6453-ACBD-AFEB} now i need to have
an output like str = 1234-4543-6453-ACBD-AFEB, basically i want to remove
the characters
'{' and '}'.

here is the code....

vector<string> Temp;

//Fill the elements in Temp
.......................
........................

//Read the elements from Temp

for (int l = 0; l < Temp.size(); ++l)
{
std::string str= Temp[l].c_str();

}


Now str outputs the values with character '{' and '}' i need it to output
values without these characters.


Pl Help.


Regards,
Venkat

std::string newstr = s.substr(1, s.length()-2);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top