procedure Val(S: String; var V; var Code: Integer);
Converts a string that represents an integer (decimal or hex notation) into a number.
S is a string-type expression; it must be a sequence of characters that form a signed real number, such as "1", "-2" or "+3". Other than the optional sign at the beginning, all characters must be digits; decimal or thousands separators are not supported.
V is an integer-type or real-type variable. If V is an integer-type variable, S must form a whole number.
Code is a variable of type Integer.
If the string is invalid, the index of the offending character is stored in Code; otherwise, Code is set to zero. For a null-terminated string, the error position returned in Code is one larger than the actual zero-based index of the character in error.