Converts a string to a number. Positive numbers are unsigned and negative numbers are signed.
2.Val usage:
Val(n) n is a string, and it must be a number, otherwise an error will occur.
For example, the result of 2+Val(" 12 ") is 14.
Extended data:
In a programming language, Val is a function that converts a string into a numeric value, and it returns the number contained in the string, which is an appropriate type of numeric value.
The Val () function stops reading the string at the first character it cannot recognize as a number. Symbols and characters that are considered as part of numerical values, such as dollar signs and commas, are not recognized. But the function can recognize the carry sign &; O (octal) and&H (hexadecimal). Delete spaces, tabs, and line breaks from parameters.
Procedure value: string; var V; Var code: integer)
S is a string type variable consisting of a series of numeric characters;
V is an integer or a real variable;
Code is an integer variable, indicating whether the conversion from string to integer is successful.
For example, the following return value is1615198: val ("1615198th Street N.E.").
In the following code, Val returns the decimal value of the hexadecimal value shown-1, Val(" &;; HFFFF”).
References:
Baidu encyclopedia -VAL