stringAsDecimal()

The system function MathLib.stringAsDecimal accepts a character value (like "98.6") and returns the equivalent value of type DECIMAL. If the input is non-numeric, the function returns a NULL.

MathLib.stringAsDecimal(numberAsText STRING in)
  returns (result DECIMAL nullable)
result
A field that can accept a value of type DECIMAL. The receiving field must be nullable and can have any decimal position and any length.

EGL allows as many as 32 digits on either side of the decimal point. The decimal point (if any) is specific to the Java™ locale.

For details on the implications of assigning numeric values to fields of different types, see Assignments.

numberAsText
A character field or literal string, which can include an initial sign character.

Example

  myField = "-5.243";

  // result = -5.243
  result = MathLib.stringAsDecimal(myField);  

Related reference
Assignments
EGL library MathLib

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.