delphi while语句死循环
functionGetBody3(constx,y,z:string):string;//在x中查找y开头,z结尾的varipos1:integer;ipos2:inte...
function GetBody3(const x , y,z: string): string; //在x中查找y开头,z结尾的
var
ipos1: integer;
ipos2: integer;
str:string;
begin
while((Pos(y, x)>0)and (Pos(z, x)>0)) do
begin
iPos1 := Pos(y, x);
iPos2 := Pos(z, x);
str:=Copy(z, iPos1, ipos2-ipos1);
result:= StringReplace(z, str, '', [rfReplaceAll]);
end;
end;
但是x是const 展开
var
ipos1: integer;
ipos2: integer;
str:string;
begin
while((Pos(y, x)>0)and (Pos(z, x)>0)) do
begin
iPos1 := Pos(y, x);
iPos2 := Pos(z, x);
str:=Copy(z, iPos1, ipos2-ipos1);
result:= StringReplace(z, str, '', [rfReplaceAll]);
end;
end;
但是x是const 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询