TIniFile.ValueExists

From Soldat Community Wiki
Revision as of 01:42, 23 August 2013 by Mighty (talk | contribs) (new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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=
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.