Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function ToBoolean: Boolean; overload; | Converts the text to a Boolean. |
| 2 | class function ToBoolean(const S: Substr.Substring): Boolean; overload; static; | |
| 3 | class function ToBoolean(const S: string): Boolean; overload; static; |
Overload 1: function ToBoolean: Boolean; overload;
Converts the text to a Boolean.
Returns: Boolean - For a number (a text ToDouble accepts), True unless it is 0; else True or False for a name in TrueBoolStrs or FalseBoolStrs ('True' and 'False' when unset), A to Z and a to z matching each other, every other character only itself.
Remarks:
Any other text raises EConvertError: '<text>' is not a valid boolean value. The class forms take every text kind.
Examples
Names and numbers.
uses Substr;
procedure Example;
begin
Assert(Substring('true').ToBoolean);
Assert(not Substring.ToBoolean('0'));
end;
See Also: Substr.StrToBool
Overload 2: class function ToBoolean(const S: Substr.Substring): Boolean; overload; static;
| # | Name | Type | Description |
|---|---|---|---|
| 1 | S | Substr.Substring |
Returns: Boolean
Overload 3: class function ToBoolean(const S: string): Boolean; overload; static;
| # | Name | Type | Description |
|---|---|---|---|
| 1 | S | string |
Returns: Boolean