Converts a Number
into a String
with commas to mark units of 1,000.
nfc()
converts numbers such as 12345 into strings formatted with commas to mark the thousands place, as in '12,345'
.
The first parameter, num
, is the number to convert to a string. For example, calling nfc(12345)
returns the string '12,345'
.
The second parameter, right
, is optional. If a number is passed, as in nfc(12345, 1)
, it sets the minimum number of digits to include to the right of the decimal place. If right
is smaller than the number of decimal places in num
, then num
will be rounded to the given number of decimal places. For example, calling nfc(12345.67, 1)
returns the string '12,345.7'
. If right
is larger than the number of decimal places in num
, then unused decimal places will be set to 0. For example, calling nfc(12345.67, 3)
returns the string '12,345.670'
.
उदाहरण
सिंटैक्स
nfc(num, [right])
nfc(nums, [right])
पैरामीटर्स
number to format.
number of digits to include to the right of the decimal point.
numbers to format.