如何轻松添加换行符
在TIniFile中?
我想将.ini中的每个部分分开
使其更具可读性。
谢谢
最佳答案
我以为我要澄清Wouter van Nifterick
的答案。 Delphi中当前的TIniFile
对象不支持换行符。为此,您必须手动进行。这是一个示例:
procedure LineBreakBeforeSection(const Filename, SectionName: String);
var
L: TStringList;
X: Integer;
S, C: String;
begin
L:= TStringList.Create;
try
L.LoadFromFile(Filename);
C:= '['+UpperCase(SectionName)+']';
for X:= 0 to L.Count - 1 do begin
S:= UpperCase(Trim(L[X]));
if S = C then begin
L.Insert(X, '');
Break;
end;
end;
L.SaveToFile(Filename);
finally
L.Free;
end;
end;
关于delphi - TIphi中的TIniFIle换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11702181/