一个简单的例子:
procedure TForm1.htmtotxt1Click(Sender: TObject);
var
sels,sele:longint;
s:string;
begin
s := richedit1.Text;
screen.Cursor := crHourGlass;
while pos('<',s) <> 0 do
begin
sels := pos('<',s);
sele := pos('>',s);
if sele = 0 then break;
if sels > sele then break;
delete(s,sels,sele-sels+1);
end;
richedit1.Text := s;
richedit1.perform(wm_vscroll,sb_top,0);
screen.Cursor := crDefault;
end;