Test if the string is a Boolean |
Member of String Intrinsic Functions (PRIM_LIBI.IStringIntrinsics)
Name | Type | Data Type | Description |
|---|---|---|---|
Result | *Result (Optional) | Boolean | True if the variable is a valid Boolean |
FalseCaption | *Input (Optional) | String | Value to use for the false value |
TrueCaption | *Input (Optional) | String | Value to use for the true value |
IsBoolean tests a string to determine whether it can be used as a boolean. The TrueCaption and FalseCaption parameters define the allowable values for the Boolean.
IsBoolean will often be used before AsBoolean to trap a potential run time error.
If no input parameters are specified, the function expects values of True or False.
In this example, isBoolean expects a value of N or Y
If (#String.IsBoolean(N Y))
#Button.Enabled := #String.IsBoolean(N Y)
Endif
This is equivalent to writing
Case (#String)
When (= Y)
#Button.enabled := True
When (= N)
#Button.enabled := False
Endcase