Delete String..or

Hi John,

Quote
> an Edit has 2 lines, with [str = Edit1->Text;] i put the 2 lines
> from the Edit into a string [str], the question is, is it possible
> to get only the second line from the string [str] (in another
> string), or to delet the first line from the string [str] ??

You can use the AnsiString::SubString() member function...

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   Memo1->Clear();
   Memo1->Lines->Add("Line 1");
   Memo1->Lines->Add("Line 2");

   const AnsiString str(Memo1->Text);

   const int pos = str.Pos("\r\n");
   const AnsiString line1(
      str.SubString(1, pos - 1)
      );
   const AnsiString line2(
      str.SubString(pos + 2, str.Length() - pos - 3)
      );  

   ShowMessage(line1);
   ShowMessage(line2);  

Quote
}

(The "-3" at the end of the line2 assignment accounts for the "\r\n"
sequence at then end of text.)

Good luck,
--
Damon Chandler (TeamB)
- BCBCAQ <http://bcbcaq.freeservers.com>
- Graphics API Black Book <http://graphicsBB.itgo.com>