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. 用于将数字格式化为字符串并将适当的逗号放置到标记单位1000的实用程序函数。有四版本: 一个用于格式化整数, 一个用于格式化整数数组, 一个用于格式化浮动, 另一个用于格式化浮动数组。
右参数的值应始终为正整数。
对于非美国语言环境, 这将插入句点, 而不是逗号, 或 apprioriate 该区域的任何位置。 |
||||||
Syntax |
nfc(nums) nfc(num) nfc(nums, right) nfc(num, right) |
||||||
Parameters |
|
||||||
Returns |
String[] |
||||||
Related |
nf() |
- 本文固定链接: http://iprocessing.cn/2017/07/21/nfc格式化成字符串千位分隔符/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表