This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries 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" int[] i = { 500000, 4000 }; String[] si = nfc(i); println(si); // Prints "500,000 4,000" float[] f = { 42525.34343, 3.14159 }; String[] fi = nfc(f, 2); println(fi); // Prints "42,525.34 3.14" | ||||||
Description |
Utility function for formatting numbers into strings and placing appropriate commas to mark units of 1000. There are four versions: one for formatting ints, one for formatting an array of ints, one for formatting floats, and one for formatting an array of floats. 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(nums) nfc(num) nfc(nums, right) nfc(num, right) | ||||||
Parameters |
| ||||||
Returns | String[] | ||||||
Related | nf() nfp() nfs() |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.