以前的帖子里有很多方法啊?你干嘛不自己查查呢??<br>procedure TForm1.FindClick(Sender: TObject);<br> var<br> i : Integer;<br> str1,str2,pathstr : String;<br> List : TStringList;<br> begin<br> str1 := ???; //要被替换的字符串<br> str2 := ???; //要替换成的字符串<br> pathstr := ???; //文本文件路径及文件名.<br> List := TStringList.Create;<br> List.LoadFromFile(pathstr);<br> for Counter := 0 to List.Count - 1 do<br> list := stringreplace(List,str1,str2,[rfReplaceAll]);<br> List.SaveToFile( Pathstr );<br> List.free;<br> end;<br>