當前位置:成語大全網 - 新華字典 - delphi字符的替換

delphi字符的替換

var

sl,AddressList :TStringList;

i :integer;

const

Address = '/@_new/@_new.exe';

begin

sl := TStringList.Create;

AddressList := TStringList.Create;

try

sl.LoadFromFile('d:\1.txt'); //載入妳的字典文件

for i := 0 to sl.Count - 1 do

AddressList.Add(StringReplace(Address,'@',sl.Strings[i],[rfReplaceAll]));

AddressList.SaveToFile('d:\2.txt'); //替換後的文件保存位置

finally

FreeAndNil(AddressList);

FreeAndNil(sl);

end;

end;