procedure TForm1.Button1Click(Sender: TObject); var lpFound: PChar; lpHtml: PChar; nHtmlLength: Integer; nStart: Integer; const OPENING_TAG_LENGTH = 8; CLOSING_TAG_LENGTH = 9; begin memoResult.Clear; lpHtml:= PChar(memoHtml.Text); nHtmlLength:= Length(memoHtml.Text); nStart:= 0; while True do begin lpFound:= SearchBuf(lpHtml, nHtmlLength, nStart, 0, ''); if lpFound = nil then break; nStart:= lpFound + OPENING_TAG_LENGTH - lpHtml; lpFound:= SearchBuf(lpHtml, nHtmlLength, nStart, 0, ''); if lpFound = nil then begin ShowMessage('Il manque au moins un tag de fermeture.'); Exit; end; memoResult.Text:= memoResult.Text + MidStr(lpHtml, nStart + 1, lpFound - lpHtml - nStart) + sLineBreak; nStart:= lpFound + CLOSING_TAG_LENGTH - lpHtml; end; end;
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question