Contents | Prev | Next
7.4.61 The val procedure
Description
The val procedure converts a string value into an integral real value and
assigns the converted value into a variable.
Parameters
- The first parameter is an expression of
string type or char type,
and is the string value to be converted.
- The second parameter is a reference to a variable of
integral type or
real type that stores the converted value.
- The third parameter is a reference to a variable of
integer type or
word type that stores the position of the first
conversion error (i.e. the first character in the string value to be converted that could not
be converted), or zero if there were no conversion errors.
Example
Given integer variables "i" and "x" the following:
val('123EB', i, x)
will store 123 in "i" and 4 in "x".
Give a real variable "r" and an integer variable "x" the following:
val('123.45', r, x)
will store 123.45 in "r" and 0 in "x".
Portability
Operating Systems: All
Standard Pascal: No
Contents | Prev | Next