11.3 atoi()
This function converts an optionally signed number string to a decimal number (ascii to integer). The following is valid:
- One sign + | -
- Digits 0…9
- Space as fill-in at each position
Let us e.g. assume that 5 is to be added to number 123 in an editable field. For this purpose, the strings "123" and "5" are interpreted as numbers 123 and 5. The result is 128.
Definition
integer atoi
(
string IntString input
)
Parameters
- string IntString input
- In this parameter the string to be changed into a number is indicated.
Return value
The value in which the string was converted.
This function call ends with an error which can be caught by the function fail(), when the indicated string does not contain any number or other characters.
Example
Sum := atoi(Edittext1.content) + atoi(Edittext2.content);