TIniFile.EraseSection

From Soldat Community Wiki
Jump to: navigation, search
procedure EraseSection(const Section: string)
 Section: Section to be erased

Description

This procedure deletes whole Section of a TIniFile

Example

example.ini in soldatserver's root folder (before the script execution)

[Section1]
Integer1=2
Bool1=2013-08-21
Bool2=2013-08-21 13:48:00
Bool3=00:00:00

[Section2]
asd=1
asd2=2

[Section3]
asd=3
faggbag=4

script code:

var
  ini: TIniFile;

begin
  ini := File.CreateINI('example.ini');
	
  ini.EraseSection('Section2');
  ini.UpdateFile;
	
  ini.Free;
end.

example.ini in soldatserver's root folder (after the script execution)

[Section1]
Integer1=2
Bool1=2013-08-21
Bool2=2013-08-21 13:48:00
Bool3=00:00:00

[Section3]
asd=3
faggbag=4