diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 05470bf67..5f469833f 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -9476,6 +9476,26 @@ public class PApplet implements PConstants { // INT NUMBER FORMATTING + static public String nf(float num) { + int inum = (int) num; + if (num == inum) { + return str(inum); + } + return str(num); + } + + static public String[] nf(float[] nums) { + String[] outgoing = new String[nums.length]; + for (int i = 0; i < nums.length; i++) { + outgoing[i] = nf(nums[i]); + } + return outgoing; + } + + /** + * Integer number formatter. + */ + static private NumberFormat int_nf; static private int int_nf_digits; static private boolean int_nf_commas; @@ -9495,34 +9515,14 @@ public class PApplet implements PConstants { * * ( end auto-generated ) * @webref data:string_functions - * @param num the number to format + * @param nums the numbers to format + * @param digits number of digits to pad with zero * @see PApplet#nfs(float, int, int) * @see PApplet#nfp(float, int, int) * @see PApplet#nfc(float, int) * @see int(float) */ - static public String nf(float num) { - int inum = (int) num; - if (num == inum) { - return str(inum); - } - return str(num); - } - /** - * @param nums the numbers to format - */ - static public String[] nf(int[] nums) { - String[] outgoing = new String[nums.length]; - for (int i = 0; i < nums.length; i++) { - outgoing[i] = nf(nums[i]); - } - return outgoing; - } - - /** - * @param digits number of digits to pad with zero - */ static public String[] nf(int nums[], int digits) { String formatted[] = new String[nums.length]; for (int i = 0; i < formatted.length; i++) { @@ -9531,6 +9531,9 @@ public class PApplet implements PConstants { return formatted; } + /** + * @param num the number to format + */ static public String nf(int num, int digits) { if ((int_nf != null) && (int_nf_digits == digits) && @@ -9678,7 +9681,6 @@ public class PApplet implements PConstants { // FLOAT NUMBER FORMATTING - static private NumberFormat float_nf; static private int float_nf_left, float_nf_right; static private boolean float_nf_commas;