TIniFile.ValueExists

From Soldat Community Wiki
Jump to: navigation, search
function ValueExists(const Section, Ident: String): Boolean
 Section: Section name
 Ident: Property name (key)

Description

This procedure returns TRUE if a key exists and FALSE otherwise

Example

example.ini in soldatserver's root folder:

[Section1]
Key1=1
Key2=

actual script code:

var
  ini: TIniFile;
  temp: Boolean;

begin
  // assuming Sandbox Level < 2
  ini := File.CreateINI('example.ini');
	
  temp := ini.ValueExists('Section1','Key1'); // temp = TRUE
  temp := ini.ValueExists('Section1','Key2'); // temp = TRUE
  temp := ini.ValueExists('Section1','Key3'); // temp = FALSE
	
  ini.Free;
end.