给你写了一段示例,你参考参考:
procedure LoadFromFile(AFile: TFileName);
var
strs: TStringList;
I: Integer;
begin
strs := TStringList.Create;
try
strs.LoadFromFile(AFile);
for I := 0 to strs.Count - 1 do
begin
strs.Strings := StringReplace(strs.Strings, ' ', '', [rfReplaceAll]);
...;
end;
finally
strs.Free;
end;
end;