lval Function
Function: |
Converts string representation of a value into 32-bit value (dword or long). |
Syntax: |
lval(byref sourcestr as string) as dword |
See Also: |
Part |
Description |
sourcestr |
String to convert. |
Details
This function recognizes &b (binary) and &h (hexadecimal) prefixes. It can be invoked implicitly through the dword_var = string_var expression (see example below). The compiler is smart enough to pre-calculate constant-only expressions involving implicit use of the lval function.
Examples
Tibbo BASIC
dim d as word
dim l as long
dim s as string
s = "4294967295"
d = lval(s) 'explicit invocation, result will be 4294967295
l = lval(s) '
d = s 'implicit invocation, result will be -1 (4294967295 -> &hFFFFFFFF -> -1 for signed variable)
d = "2402" 'be calculated at compilation -- no actual lval function invokation will be here