嗨我有一个用Inno Setup(基于Delphi)替换文本文件中的文本的问题。用Inno Setup替换文件中的文本
我的代码:
procedure FileReplaceString(const FileName, searchstring, replacestring: string);
var
fs: TFileStream;
S: string;
begin
fs := TFileStream.Create(FileName, fmOpenread or fmShareDenyNone);
try
SetLength(S, fs.Size);
fs.ReadBuffer(S[1], fs.Size);
finally
fs.Free;
end;
{ the compiler stops here with: unknown identifier 'StringReplace' }
S := StringReplace(S, SearchString, replaceString, [rfReplaceAll, rfIgnoreCase]);
fs := TFileStream.Create(FileName, fmCreate);
try
fs.WriteBuffer(S[1], Length(S));
finally
fs.Free;
end;
end;
我发现我不得不使用StringChange()
,而不是,但我不知道怎么跟我的代码中使用它。我不太了解Delphi或Inno Setup。 我希望你能帮助我。
'Inno Setup!= Delphi'。 Inno Setup在Delphi中编译,但它使用基于Pascal脚本的语言。 – TLama
Thx为您的答案。那么现在应该如何更改我的代码。 – user3025417
该输入文件是否包含Unicode文本? – TLama