Board index » cppbuilder » How to modify the same "string" from the [1] position to the end of the line (New problem...)
Oren (Halvani.de)
![]() CBuilder Developer |
How to modify the same "string" from the [1] position to the end of the line (New problem...)2003-08-11 02:49:05 AM cppbuilder74 hi dear builders, I've got a problem that was posted here before, Thread-Name: " How can I insert/modify the same "string" from the [0] position to the end of the line...? " Remy post me the below code, I modify it to take user-specific Start and End of a tag like: <XML>(beginn is "<" end is ">") I mean insted of "<" and ">" the user is now able to define his own Start and End "symbol/char".. The problem is after the change the function fails with a "invalid Variant converting" Where is exactly the problem...? /*******************************************************************/ AnsiString str; AnsiString Anfang = Edit1->Text[1], Ende = Edit2->Text[1]; // Is this the problem...? frmStringDetails->Memo1->Lines->BeginUpdate(); try { for(int i = 0; i < frmStringDetails->Memo1->Lines->Count; i++) { str = frmStringDetails->Memo1->Lines->Strings[i]; if(!str.IsEmpty() ) { if( str[1] == Anfang) // '<' { int pos = str.Pos(Ende); // '>' if( pos != 0 ) { AnsiString tag = str.SubString(2, pos - 2).Trim(); if( !tag.IsEmpty() ) { if( str.Pos("</" + tag + ">") == 0 ) { str += ("</" + tag + ">"); frmStringDetails->Memo1->Lines->Strings[i] = str; } } } } } } } __finally { frmStringDetails->Memo1->Lines->EndUpdate(); } /*******************************************************************/ Thanks for any help.. Oren |