下面是delphi的“替换”的代码 单个替换是无问题 但不能全部替换 请问出现了什么问题 5
procedureTForm1.ReplaceDialog1Replace(Sender:TObject);vars:string;beginiffrreplaceall...
procedure TForm1.ReplaceDialog1Replace(Sender: TObject);
var
s:string;
begin
if frreplaceall in replacedialog1.Options then
begin
ReplaceDialog1Find(self);
if founditem then
begin
s:=listbox1.Items[findIndex-1] ;
while findindex<listbox1.Items.Count do
begin
if frmatchcase in replacedialog1.Options then
listbox1.Items[findindex-1]:=stringreplace(s,replacedialog1.FindText,replacedialog1.ReplaceText,[rfreplaceall,rfignorecase])
else
listbox1.Items[findindex-1]:=stringreplace(s,replacedialog1.FindText,replacedialog1.ReplaceText,[rfreplaceall]);
inc(findindex) ;
if findindex<listbox1.Items.Count then
exit
else
s:=listbox1.Items[findindex] ;
end;
end
else
if not founditem then
replacedialog1find(self) ;
end
else
begin
replacedialog1find(self) ;
s:=listbox1.Items[findIndex-1] ;
if frmatchcase in replacedialog1.Options then
listbox1.Items[findindex-1]:=stringreplace(s,replacedialog1.FindText,replacedialog1.ReplaceText,[rfreplaceall,rfignorecase])
else
listbox1.Items[findindex-1]:=stringreplace(s,replacedialog1.FindText,replacedialog1.ReplaceText,[rfreplaceall]);
end;
end;
end. 展开
var
s:string;
begin
if frreplaceall in replacedialog1.Options then
begin
ReplaceDialog1Find(self);
if founditem then
begin
s:=listbox1.Items[findIndex-1] ;
while findindex<listbox1.Items.Count do
begin
if frmatchcase in replacedialog1.Options then
listbox1.Items[findindex-1]:=stringreplace(s,replacedialog1.FindText,replacedialog1.ReplaceText,[rfreplaceall,rfignorecase])
else
listbox1.Items[findindex-1]:=stringreplace(s,replacedialog1.FindText,replacedialog1.ReplaceText,[rfreplaceall]);
inc(findindex) ;
if findindex<listbox1.Items.Count then
exit
else
s:=listbox1.Items[findindex] ;
end;
end
else
if not founditem then
replacedialog1find(self) ;
end
else
begin
replacedialog1find(self) ;
s:=listbox1.Items[findIndex-1] ;
if frmatchcase in replacedialog1.Options then
listbox1.Items[findindex-1]:=stringreplace(s,replacedialog1.FindText,replacedialog1.ReplaceText,[rfreplaceall,rfignorecase])
else
listbox1.Items[findindex-1]:=stringreplace(s,replacedialog1.FindText,replacedialog1.ReplaceText,[rfreplaceall]);
end;
end;
end. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询