String Intrinsic Functions - IsBoolean Method

Test if the string is a Boolean

Member of String Intrinsic Functions (PRIM_LIBI.IStringIntrinsics)

Parameters

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

Details

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.

Example

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

See also

All Component Classes

Technical Reference

  • No labels