val

Convert an ASCII string into an unsigned integer type variable.

The string can be in one of three formats:
Decimal no prefix
Binary 0b or 0B prefix
Hex 0x or 0X prefix

The string is converted from the beginning, to the first invalid character or the end of the string is reached.

Syntax: var = Val(string)

string

Required. String to be converted

char

The converted value

 

 Example:

Dim s(10) As String
Dim x as uInteger
 
s="123"
x=Val(s)     ' x=123
 
s="0xA50f"
x=val(s)     ' x=42255
 
s="0B10001111"
x=Val(s)     ' x=143

Also See: str, strBin, strFixed, strHex