This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name

nfc()

Examples
int i = 500000; 
String si = nfc(i);
println(si);  // Prints "500,000"
float f = 42525.34343; 
String fi = nfc(f, 2);
println(fi);  // Prints "42,525.34"

Description Utility function for formatting numbers into strings and placing appropriate commas to mark units of 1000. There are two versions: one for formatting ints, and one for formatting an array of ints. The value for the right parameter should always be a positive integer.

For a non-US locale, this will insert periods instead of commas, or whatever is apprioriate for that region.
Syntax
nfc(num)
nfc(num, right)
Parameters
num float[], or int[]: the number(s) to format
right int: number of digits to the right of the decimal point
ReturnsString[]
Relatednf()
nfp()
nfc()
Updated on May 19, 2014 05:30:00pm PDT

Creative Commons License