Val
From REALbasicWiki
Contents |
[edit] Prototype
Function Val(value as String) as numeric value
[edit] Description
Val attempts to extract a number literal from the passed string and convert it to a number. If it fails, it returns 0.
[edit] Discussion
Val looks for a numeric literal from the beginning of the string, Thus it will read a string like "123abc" and return the value 123.
Val recognizes the literal prefixes &b, &o, &h, and will consider them when parsing the numeric data.
[edit] Sample Code
dim pi as Double = Val(3.1415927)
dim fortySeven as Integer = Val("&b00101111")
