String Qns

Nov 14, 2010 at 2:28pm
For string, the first character is starting from 0 or 1?

Qns 1:
1
2
3
string s1("LovePeaceJoy");
s1.replace(2, 3, "Love");
cout << "s1: " << s1 << endl;




Qns 2:
1
2
3
string s2("Well");
s2.append("StayHealthy",4, 4);
cout << "s2: " << s2 << endl;
Last edited on Nov 15, 2010 at 4:18am
Nov 14, 2010 at 2:33pm
0.
Nov 14, 2010 at 2:55pm
What is the meaning for

s2.append("StayHealthy",4, 4); //Erase "Stay" & add "Heal"? Why erase "Stay"?
Last edited on Nov 15, 2010 at 4:23am
Nov 15, 2010 at 2:24pm
Topic archived. No new replies allowed.