procedure getStr(var source:string;beginStr,endStr:string);
var P1,p2:integer;
begin
p1:=pos(beginStr,source);
p2:=pos(endstr,source);
if (p1<>0) and (p2<>0) then
begin
delete(source,p2,length(endStr));
delete(source,p1,length(beginStr));
end
else showmessage('出错');
end;
procedure TForm1.Button1Click(Sender: TObject);
var s1:string;
begin
s1:='<money>1333.56</money>';
getstr(s1,'<money>','</money>');
s1:='你的金额为'+s1;
showmessage(s1);
end;
procedure TForm1.Button2Click(Sender: TObject);
var s2:string;
begin
s2:='<ifpass>1</ifpass>';
getstr(s2,'<ifpass>','</ifpass>');
if s2='1' then showmessage('密码正确');
end;