For more information on how to construct a format string, see Numeric formatting symbols .
strLib.formatNumber( value SMALLINT? | INT? | BIGINT? | DECIMAL? | MONEY? | SMALLFLOAT? | FLOAT? in [ , numericFormat STRING? in] ) returns (result STRING?)
The following example shows a DECIMAL number formatted to print on a paycheck.
myNum DECIMAL(9,2) = -27459.01; myFormat STRING = "(*,***,###.##)"; result STRING; result = strLib.formatNumber(myNum,myFormat); // result is (***27,459.01)
Platform | Issue |
---|---|
COBOL generation | When you format floating point numbers, you cannot specify a format. If you call the function with a second parameter, you receive a validation error. |
JavaScript generation | The function strLib.formatNumber() is not supported. |