|
Val | |||||
Result# = Val(InputString$) | |||||
Parameters: InputString$ = The string you wish to convert to a value |
|||||
Returns: Result# = The returned value |
|||||
The Val function converts a string of numeric characters to a value. The function expects that the string to contain only valid numeric characters (0123456789), if not, you will get unexpected result. This function not only supports integer values and floating point values, but binary and hexadecimal values also. FACTS: * Val can handle integer and float values. If you wish it to return a float use the Val#(), otherwise it'll return the value as an integer. * Val can handle Binary formatted strings (Bin$). To be evaluated as binary, val expects the first character to be the "%" symbol * Val can handle Hexadecimal formatted strings (Hex$). To be evaluated as hex, val expects the first character to be the "$" symbol Mini Tutorial #1: Integer Conversion Converting a value to a string, then back again.
This example would output.
Mini Tutorial #2: Float conversion Converting a float value to a string, then back again.
Mini Tutorial #3: Binary And Hex conversions Handling Binary and Hex strings.
This example would output.
|
Related Info: | Bin$ | Float | Hex$ | Integer | Str$ : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |