Hello,
I should tell you I don't know much about C++ before i get started.
Ok, what I need is a way to replace some letters between the marks i choose.
For example:
string str1 = "whatsup<1> the string<2>hello" ;
I call a function that replaces everything between "<1>" and "<2>" with "is gone".
str1 now becomes "whatsup<1> is gone<2>hello";
the length of the string will always be different and so i can't just tell it to start removing at some static position from the start.
What I came up with is maybe make a loop that goes over each letter in the string and looking for <1> while counting how many letters have past and then count the distance between <1> and <2>. Delete the letters between those two some how and then use some replace method with the "position where to start replacing" method and replace the blank spot between the two.
But then again I might be an idiot so please give me some ideas.
I should tell you I don't know much about C++ before i get started.
Ok, what I need is a way to replace some letters between the marks i choose.
For example:
string str1 = "whatsup<1> the string<2>hello" ;
I call a function that replaces everything between "<1>" and "<2>" with "is gone".
str1 now becomes "whatsup<1> is gone<2>hello";
the length of the string will always be different and so i can't just tell it to start removing at some static position from the start.
What I came up with is maybe make a loop that goes over each letter in the string and looking for <1> while counting how many letters have past and then count the distance between <1> and <2>. Delete the letters between those two some how and then use some replace method with the "position where to start replacing" method and replace the blank spot between the two.
But then again I might be an idiot so please give me some ideas.
Comment