str2int

Converts a string to integer value.

str2int <intvar> <string>

Remarks

Converts the <string> to its numeric value. The value is returned in the integer variable <intvar>.
You can specify the <string> as a format of decimal and hexadecimal number.

A decimal number     - 123, 0009
A hexadecimal number - 0x7b, $7b

If the string is converted successfully, the system variable "result" is set to 1. Otherwise, "result" is set to zero.

Example

str2int val '123'
; val=123, result=1

str2int val '123abc'
; val=123, result=1

str2int val '0009'
; val=9,   result=1

str2int val 'abc'
; val=0,   result=0

hexnum='0x456FE3'
str2int val hexnum
sprintf '%d %x' val val
messagebox inputstr 'test'
; val=4550627, result=1