GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Five — General Functions (continued)
Overview
The TextToInteger function automatically detects and converts a string containing a hexadecimal, octal, or signed decimal number into an integer equivalent.
Syntax/Parameters
Syntax
long = TextToInteger ( string value );
Parameters
value
A string containing a hexadecimal, octal, or decimal number.
Return Value
Returns an long containing the integer equivalent of value or 0 on failure. Use the GetLastError function to retrieve error information.
Remarks
The TextToInteger function is the most general conversion tool for translating strings to integers. It does not require prior knowledge of what type of value (hexadecimal, octal, or decimal) the string contains. For decimal numbers, the source string can contain commas. String parsing will stop at the first non-digit. 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. Note that this function is not appropriate for converting decimal numbers with leading zeros since they will be interpreted as octal numbers which will result either in an erroneous return value or a syntax error. Use the DecimalToInteger function or trim the leading zeros, as required, if leading zeros are possible.
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
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.