Converts a number in character format to numeric format.
character-expression.ToNumeric()
Type Returned:
Numeric N(18.2)
Where:
character-expression
Must be a character expression.
Objects: Procedure, Transaction, Web Panel, Work Panel
Generators:
.NET,
Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)
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 ToNumeric function will be 0.
&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 (*)
(*) Converting alphanumerics to numerics is not supported when the method is evaluated in the DBMS (see Server Side Functions/Methods or SAC 42709).
Val function
Str function
ToString method