Mendix 7 is no longer supported unless you have Extended Support. Mendix 7 documentation will remain available until July 2024.

To upgrade to a supported version, see Moving from Desktop Modeler Version 7 to Studio Pro 8.

Parse and Format Float Function Calls

Last modified: April 9, 2024

See Class DecimalFormat for all pattern possibilities.

parseFloat

Parses a String value to a Float value. Takes optional parameters for format and default value.

Input parameters

  • value to parse Type: String
  • pattern to match on (optional) Type: String
  • default value (optional) Type: Float

Output

A Float value that matches the input String value. If the value cannot be parsed (as in, does not match the format parameter or contains illegal characters) the default value will be returned. If no default value was provided, an error occurs.

1
parseFloat('3.45')

returns:

1
3.45

with default value:

1
parseFloat('noFloat',5.05)

returns:

1
5.05

with format parameter:

1
parseFloat('$3.33', '$#.##')

returns:

1
3.33

formatFloat

Converts a Float value to a String value, according to a specified format.

Input parameters

  • value to convert Type: Float
  • format that the result should be in Type: String

Output

A String representation of the Float value, in the format specified by the ‘format’ parameter. Type: String

1
formatFloat(1234.56, '#,###.#')

returns:

1
'1,234.5'