NUM() Function - Convert String to Numeric

Syntax

NUM(string{,ERR=lineref})

Description

For BBj-specific information, see NUM() Function - BBj.

The NUM() function converts a string argument to a numeric equivalent.

Parameter

Description

string

String to be converted. It must conform to the rules for numeric constants described in the Language Concepts section of the User's Reference Guide.

ERR=lineref

Branch to be taken if an error occurs during execution.

The NUM() function's operations may be affected by the OPTS value. See the SETOPTS Verb for additional information.

The STR() Function is complementary to the NUM() function.

Examples

>PRINT NUM("123.45")
123.45
>PRINT NUM(" 34 ")
34
>PRINT NUM("100A")
!ERROR=26 (STRING/NUMBER MISMATCH)

See Also

Functions - Alphabetical Listing