CONVERT

Use the CONVERT script function to convert the data type of a value. The script function lets you convert values that have been specified directly, or through a script variable. The script function returns the value with the converted data type. Assign the return code of the script function to a variable to use the converted value.

Important! Ensure that the data types match, as mismatches can cause errors:

Notes:

Syntax

CONVERT (Data type, value)

Parameters


Example

The following script converts a positive integer into a string.

:define &unsigned#, unsigned
:define &string#, string

:set &unsigned# = 12
:set &string# = CONVERT(string, &unsigned#)

The following script converts a string to a number. This conversion is possible because the string in the example consists of a number in a format that is valid for the target data type.

:define &unsigned#, unsigned
:define &string#, string

:set &string# = "1234"
:set &unsigned# = CONVERT(unsigned,&string#)

See also:

seealso

:DEFINE