Creates a custom-formatted number value. For international
number formatting use LSNumberFormat.
The mask is made up of:
_,9 Digit placeholder; . decimal point; 0 Pads with zeros;
( ) less than zero, puts parentheses around the mask
+ plus sign before positive number minus before negative
- a space before positive minus sign before negative
, Separates every third decimal place with a comma.
L,C Left-justifies or center-justifies number
$ dollar sign before formatted number.
^ Separates left and right formatting.

numberFormat(number [, mask]) → returns string

numberFormat Argument Reference

number numeric

mask string

Links more information about numberFormat

Examples sample code invoking the numberFormat function

Two decimal places, decimal input


Expected Result: 1.23

Two decimal places, integer input


Expected Result: 123.00

Zero will pad zeros; nine doesn’t

num1 = NumberFormat(123,'00000');
num2 = NumberFormat(123,'99999');

Expected Result: 00123/ 123

show positive/negative sign

num1 = NumberFormat( 5, "+" );
num2 = NumberFormat( -5, "+" );

Expected Result: +5/-5

Fork me on GitHub