Difference between revisions of "StrToBoolDef"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function StrToBoolDef(s: AnsiString; def: Boolean): Boolean; </source> ==Availability== SCAR Divi 3.00 > Current ==Description...")
 
(No difference)

Latest revision as of 17:31, 3 July 2011

Definition

function StrToBoolDef(s: AnsiString; def: Boolean): Boolean;

Availability

SCAR Divi 3.00 > Current

Description

Converts a given string Str to a boolean value. If Str equals 'false' or '0', the result will be [false], if the Str is 'true' or a string representing any integer value that does not equal 0, the function returns true. In the event that Str is not a valid boolean value, the function will return the given value def.

Example

begin
  WriteLn(StrToBoolDef('True', False));
  WriteLn(StrToBoolDef('False', False));
  WriteLn(StrToBoolDef('lol', False));
end.

Output:

1
0
0

See Also