I have a richTextBox where I am trying to replace all strings that look like this:
"stringvec[11][12]".
I have this for loop so far that would work if the string always had the same lentgh but the thing is that I will not know if the string also can look like this: "stringvec[1][2]" wich gives another length.
So what I beleive is to find a way to know when the string has ended or find the last "]" of the string.
My problem is then to know how to define the second argument for:
Select( startP, );
I have tried something in the code as seen but this does not work.
for(int startP = richTextBox1->Text->IndexOf("stringvec[");
-1 != startP;
startP = richTextBox1->Text->IndexOf("stringvec[", startP + 10))
{
int endP = richTextBox1->Text->IndexOf("]");
this->richTextBox1->Select( startP, (endP - startP));
this->richTextBox1->SelectedText = "word2";
this->richTextBox1->DeselectAll();
}