stringAsFloat()

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

If the character value to be converted is null or blank, the return value depends on the value of the I4GLItemsNullable property (see i4glItemsNullable). If I4GLItemsNullable is set to YES, the function returns a null value; otherwise the function returns 0. This behavior is the reason to use mathLib.stringAsDecimal rather than making a simple assignment (see Assignments). If you assign a blank value to a FLOAT variable, EGL will throw an exception.

  mathLib.stringAsFloat(numberAsText STRING in)
  returns (result FLOAT nullable)
numberAsText
A character field or literal string, which can include an initial sign character.
result
A field that can accept a FLOAT value. The receiving field must be nullable and can have any decimal position and any length. If you are generating Java™ code, the decimal point (if any) is specific to the locale.

Example

  myField = "-5.243";

  // result = -5.243
  result = mathLib.stringAsFloat(myField);  

Feedback