Registriert seit: 23. Jan 2008
3.686 Beiträge
Delphi 2007 Enterprise
|
AW: FormatINI
18. Mai 2015, 21:11
Gibt es einen Unterschied im Ergebnis zu diesem etwas knapperen hier?
Delphi-Quellcode:
procedure FormatINI(aFilename: String);
var
f: TStringlist;
i: Integer;
begin
f := TStringlist.Create;
f.LoadFromFile(aFilename);
// Remove blank lines
i := 0;
while i < f.Count do
begin
if Length(Trim(f[i]))=0 then
f.Delete(i)
else
inc(i);
end;
// Add blank lines before section headers
i := f.Count-1;
while i>0 do
begin
if (Length(Trim(f[i]))>0) and (Trim(f[i])[0]=' [') then
f.Insert(i, ' ');
dec(i);
end;
f.SaveToFile(aFilename);
f.Free;
end;
"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins)
Geändert von Medium (18. Mai 2015 um 21:17 Uhr)
|