Scope
Objects: Procedures, Transactions, Web Panels, Work Panels Languages: .NET, Java, Ruby, Visual FoxPro
Purpose
Converts a number in character format to numeric format.
Syntax
character-expression.ToNumeric()
Type Returned: Numeric N(18.2)
Where: character-expression Must be a character expression.
Description
This function converts the numbers of a character expression to a numeric type. It processes the numbers in the character expression from left to right until a non-numeric character is encountered. If the first character of the character expression is not a number, the result of Val function will be 0.
Examples&AcceptTxt9 = '-123.35' &Nbr = &AcceptTxt9.ToNumeric() // Result: &Nbr = -123
&AcceptTxt9 = 'ABC' &Nbr = &AcceptTxt9.ToNumeric() // Result: &Nbr = 0
&AcceptTxt9 = '12A' &Nbr = &AcceptTxt9.ToNumeric() // result: &Nbr = 12
See Also
Val Function Str Function ToString Method
|