Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter FiveGeneral Functions (continued)

DecimalToInteger Function

Overview

The DecimalToInteger function converts a string containing a decimal number to an integer value.

Syntax/Parameters

Syntax

long = DecimalToInteger ( string data | wstring data);

Parameters

data

A string or wstring containing a decimal number.

Return Value

Returns a long containing the integer equivalent of value or 0 on failure. Use the GetLastError function to retrieve error information.

Remarks

The DecimalToInteger function converts a string containing a decimal number to an integer; this should not be confused with the DecimalToFloat function, which converts a string containing a floating-point number to a floating-point data type. This function handles the sign appropriately. The inclusion of any other characters aside from digits and sign will cause the DecimalToInteger function to fail. Because this function can return 0 as both a permissible value and as an error, use the GetLastError function to ensure the function succeeded.

Decimal numbers may lead with a ‘-’ character to indicate a negative number.

This function returns a 64-bit value. Depending on the source value parameter, if the return value is stored in an int type (or smaller), the value will be truncated if it exceeds the 32-bit integer size. Such a condition is considered a runtime warning which will be placed in the program log.

If the string parameter cannot be converted to an integer, the GetLastError function will return ERROR_SYNTAX.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic