Name
ToNumber -- convert a string to a number (V2.0)
Synopsis
n = ToNumber(s$[, base])
Function
This function tries to convert the string specified in s$ to a number. The optional argument base can be used to convert binary, octal, and hexadecimal numbers or any other bases ranging from 2 to 36. It defaults to 10 (decimal). In bases from 11 to 36 the letters of the English alphabet are used as the additional digits (10=A, 35=Z). Case sensitivity is not required.

Starting with Hollywood 6.0 this function can also convert a variable of type #LIGHTUSERDATA to a number. Since this variable type is meant to store pointers, it is only interesting for expert users or debugging purposes.

Inputs
s$
string to convert
base
optional: base of the conversion (defaults to 10)
Results
number
converted number
Example
r = ToNumber("10000")         ; returns 10000
r = ToNumber("10110111", 2)   ; returns 183
r = ToNumber("523", 8)        ; returns 339
r = ToNumber("FFFF", 16)      ; returns 65535

Show TOC