- Function Val(str)
Val
Val(
str ! (input) string or element expression
)
Arguments
- str
A scalar string or element expression.
Return Value
The function
Valreturns the numerical value represented by the string or element str.
Example
_s_nums := data { 1, '3.14' } ;
_p_returnA := Val( first( _s_nums ) ); ! returns 1
_p_returnB := Val( last( _s_nums ) ); ! returns 3.14
_p_returnC := Val( "33" ); ! returns 33
_p_returnD := Val( "1.0e3"); ! returns 1000
Note
If str cannot be interpreted as a numerical value, a runtime error may
occur, see option suppress error messages of val function.
See also
The
Valfunction is discussed in full detail in Intrinsic Functions for Sets and Set Elements of the Language Reference.