formatNumber()

The string function StrLib.formatNumber returns a number as a formatted string.

  StrLib.formatNumber(
    numericExpression anyNumericExpression in
     [ , numericFormat STRING in] )
  returns (result STRING)
result
A variable of type STRING.
numericExpression
The numeric value to be formatted. Can be any expression that resolves to a number.
numericFormat
A string that defines how the number is to be formatted. The string is optional.

You can use the system variable StrLib.defaultMoneyFormat or StrLib.defaultNumericFormat. For details on those variables, see defaultMoneyFormat and defaultNumericFormat.

.
Valid characters are as follows:
#
A placeholder for a digit.
*
Use an asterisk (*) as the fill character for a leading zero.
&
Use a zero as the fill character for a leading zero.
#
Use a space as the fill character for a leading zero.
<
Left justify the number.
,
Use a locale-dependent numeric separator unless the position contains a leading zero.
.
Use a locale-dependent decimal point.
-
Use a minus sign (-) for values less than 0; use a space for values greater than or equal to 0.
+
Use a minus sign for values less than 0; use a plus sign (+) for values greater than or equal to 0.
(
Precede negative values with a left parenthesis, as appropriate in accounting.
)
Place a right parenthesis after a negative value, as appropriate in accounting.
$
Precede the value with the locale-dependent currency symbol.
@
Place the locale-dependent currency symbol after the value.
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.