Val
Syntax
Expression = Val ( String )
Converts a string into a boolean, a number or a date, according to the content of the string.
 |
The current localization is used to convert numbers and dates.
|
The conversion algorithm is the following:
- If the string can be interpreted as a date & time (with date or time separators), then the date & time is returned.
- Else, if the string can be interpreted as a floating point number, then this floating point number is returned.
- Else, if the string can be interpreted as a integer number, then this integer number is returned.
- Else, if the string is "True" or "False" , then the matching boolean value is returned.
- Otherwise, NULL is returned.
Examples
PRINT Val("09/06/72 01:00")
<hr>09/06/72 01:00:00
PRINT Val("3.1415")
<hr>3.1415
PRINT Val("-25")
<hr>-25
PRINT Val("True")
<hr>True
PRINT IsNull(Val("Gambas"))
<hr>True