Inserting into a string
How does one change the string "6013456" to "601-3456"?
Can you help me out? That's so hard to read. I looked at it before.
I don't see whats so hard. The first parameter to insert() is the position you with to insert at. The second parameter is the text to insert.
1 2 3 4 5
|
string number = "6013456";
number.insert(4, '-');
cout << number;
|
It's 3, but thanks =). First help from this forum. =)
Topic archived. No new replies allowed.