ToInteger
Description:
Convert numeric characters in a string to an integer number.
Format:
ToInteger (string Text)
|
Parameters: |
String |
Text |
Text that contains a number. |
|
Return Value: |
Integer |
Number |
The converted number |
Usage:
Use this function to convert a String that contains a number to an Integer number. Data from Documents is all in a Text (String) format. Math cannot be performed on Text. This function will convert a string that happens to contain numeric characters into a number that can be manipulated with mathematical functions. All the characters in the string must consist of a valid number. If the string does not contain a valid number, the function returns 0. Valid numbers consist of a an optional sign (+ or -), and the numbers 0 – 9. Examples of valid strings are: '123', '-123', '+123'. Examples of invalid strings are: '123-', '12345 ABC', '123 456'
Example 1:
Convert a String containing '12' into an Integer and then multiply it by 2.
String strData
Integer intResult
// Set string data
strData = '12'
// Convert the string and multiply by 2
intResult = ToInteger (strData) * 2