RPGspVal Function


Converts a character string to a numeric value.


Syntax

RPGspVal(character string)

Part Description
character string Required. Character string representing a number.


Remarks

This function is often used to convert Form Input, Session Variables, Cookie Values, and Query String Parameters to a numeric data type. It is required because the browser handles all variables, even numbers, as character strings. The string can contain decimals, a negative sign, or group separator such as commas.

RPGspVal('1,824.89-') will return -1824.89.

RPGspVal('$25.00') will return 25.

RPGspVal('Hello') will return 0.


Example

Here is an example where we retrieve a form entry called 'QTY' and assign it to a numeric RPG variable.

     C                   Eval      QTY = RPGspVal(RPGspIn('QTY':'Input'))  


See Also

RPGspIn

%Char


Profound Logic Software, Inc.
www.ProfoundLogic.com
(937) 439-7925