stringAsFloat()

The system function MathLib.stringAsFloat accepts a character value (like "98.6") and returns the equivalent value of type FLOAT. If the input is nonnumeric, the function returns a NULL.

  MathLib.stringAsFloat(numberAsText STRING in)
  returns (result FLOAT nullable)
result
A field that can accept a value of type FLOAT. The receiving field must be nullable and can have any decimal position and any length. 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.stringAsFloat(myField);  

Related reference
Assignments
EGL library MathLib

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