Util.Cast

Top  Previous  Next

 

Syntax

function Util.Cast(Value: variant; CastToType: integer): variant

 

Alternative Names

ibec_Cast

 

Description

Converts a value from one data type to another.

 

The Return Value is the Value but converted to the type given in the second parameter.

 

CastToType can be one of the following predefined constants:

__typeInteger
__typeInt64
__typeDouble
__typeDate
__typeTime
__typeDateTime
__typeString

 

 

 

 

See Also

Util.CastEx

 

Example

execute UDSBlock

as

declare DTValue date; /* declare strong typed date value variable */

begin

  /* StrValue becomes '10' */

  StrValue = Util.Cast(10, __typeString);

 

  /* IntValue becomes -1 as 'A' is not a valid integer */

  IntValue = Util.CastEx('A', __typeInteger, '-1');

 

  /* converts the date to a date value, as per Windows settings */

  DTValue = Util.Cast('2022/12/13', __TypeDate);

end