convert

Converts string to integer value.

Syntax

convert(expr)

Argument

expr
A valid character string or numeric value.

Example

Templex Expression Result
{convert(96)} "96"
{convert("1.21")} 1.21
{convert("12a")} 12
{convert("Thursday")} 0
{convert(100, "%8d")} 0

Comments

The convert function converts a string to a value or a value to a string. expr may be a scalar or a string.

If expr is a string and contains none of the characters 0 through 9, the result is 0.

If expr is a string and contains only the characters 0 through 9, a minus sign (-), or a decimal point (.), the result is a scalar with the same value as the numeric value represented by the string.

If expr is a string and contains characters other than 0 through 9, a minus sign (-), or a decimal point (.), the result is a scalar with the same value as the numeric value represented by the string. The invalid characters are ignored. The result is 0.

If expr is a scalar, the result is a string that represents the value of expr.