Difference between revisions of "GetINISections"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function GetINISections(const FileName: string): TStringArray; </source> ==Availability== SCAR Divi 3.25 > Current ==Descripti...")
 
(Example)
 
Line 14: Line 14:
 
var
 
var
 
   sa: TStringArray;
 
   sa: TStringArray;
  i: Integer;
 
  
 
begin
 
begin
Line 20: Line 19:
 
   WriteINI('Section2', 'Key', 'Hello World!', LogsPath + 'Test.ini');
 
   WriteINI('Section2', 'Key', 'Hello World!', LogsPath + 'Test.ini');
 
   sa := GetINISections(LogsPath + 'Test.ini');
 
   sa := GetINISections(LogsPath + 'Test.ini');
   for i := Low(sa) to High(sa) do
+
   WriteLn(Implode(',', sa));
    WriteLn(sa[i]);
 
  
 
   DeleteFile(LogsPath + 'Test.ini');
 
   DeleteFile(LogsPath + 'Test.ini');
Line 28: Line 26:
  
 
Output:
 
Output:
  Section
+
  Section,Section2
Section2
 
  
 
==See Also==
 
==See Also==

Latest revision as of 12:06, 1 July 2011

Definition

function GetINISections(const FileName: string): TStringArray;

Availability

SCAR Divi 3.25 > Current

Description

Returns a list as a TStringArray containing all sections in the INI file specified by FileName. When FileName contains an invalid file path, an exception is thrown and the script is stopped.

Example

var
  sa: TStringArray;

begin
  WriteINI('Section', 'Key', 'Hello World!', LogsPath + 'Test.ini');
  WriteINI('Section2', 'Key', 'Hello World!', LogsPath + 'Test.ini');
  sa := GetINISections(LogsPath + 'Test.ini');
  WriteLn(Implode(',', sa));

  DeleteFile(LogsPath + 'Test.ini');
end.

Output:

Section,Section2

See Also