Skip to content

Commit 1f95a7a

Browse files
committed
Working toward fixing reference for nf()
1 parent d72f111 commit 1f95a7a

File tree

1 file changed

+23
-30
lines changed

1 file changed

+23
-30
lines changed

core/src/processing/core/PApplet.java

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9476,28 +9476,6 @@ static final public String[] str(float x[]) {
94769476

94779477
// INT NUMBER FORMATTING
94789478

9479-
9480-
static public String nf(float num) {
9481-
int inum = (int) num;
9482-
if (num == inum) {
9483-
return str(inum);
9484-
}
9485-
return str(num);
9486-
}
9487-
9488-
9489-
static public String[] nf(float[] num) {
9490-
String[] outgoing = new String[num.length];
9491-
for (int i = 0; i < num.length; i++) {
9492-
outgoing[i] = nf(num[i]);
9493-
}
9494-
return outgoing;
9495-
}
9496-
9497-
9498-
/**
9499-
* Integer number formatter.
9500-
*/
95019479
static private NumberFormat int_nf;
95029480
static private int int_nf_digits;
95039481
static private boolean int_nf_commas;
@@ -9517,13 +9495,34 @@ static public String[] nf(float[] num) {
95179495
*
95189496
* ( end auto-generated )
95199497
* @webref data:string_functions
9520-
* @param nums the numbers to format
9521-
* @param digits number of digits to pad with zero
9498+
* @param num the number to format
95229499
* @see PApplet#nfs(float, int, int)
95239500
* @see PApplet#nfp(float, int, int)
95249501
* @see PApplet#nfc(float, int)
95259502
* @see <a href="https://processing.org/reference/intconvert_.html">int(float)</a>
95269503
*/
9504+
static public String nf(float num) {
9505+
int inum = (int) num;
9506+
if (num == inum) {
9507+
return str(inum);
9508+
}
9509+
return str(num);
9510+
}
9511+
9512+
/**
9513+
* @param nums the numbers to format
9514+
*/
9515+
static public String[] nf(int[] nums) {
9516+
String[] outgoing = new String[nums.length];
9517+
for (int i = 0; i < nums.length; i++) {
9518+
outgoing[i] = nf(nums[i]);
9519+
}
9520+
return outgoing;
9521+
}
9522+
9523+
/**
9524+
* @param digits number of digits to pad with zero
9525+
*/
95279526
static public String[] nf(int nums[], int digits) {
95289527
String formatted[] = new String[nums.length];
95299528
for (int i = 0; i < formatted.length; i++) {
@@ -9532,10 +9531,6 @@ static public String[] nf(int nums[], int digits) {
95329531
return formatted;
95339532
}
95349533

9535-
/**
9536-
* @param num the number to format
9537-
* @param digits number of digits to pad with zero
9538-
*/
95399534
static public String nf(int num, int digits) {
95409535
if ((int_nf != null) &&
95419536
(int_nf_digits == digits) &&
@@ -9703,8 +9698,6 @@ static public String[] nf(float nums[], int left, int right) {
97039698

97049699
/**
97059700
* @param num the number to format
9706-
* @param left number of digits to the left of the decimal point
9707-
* @param right number of digits to the right of the decimal point
97089701
*/
97099702
static public String nf(float num, int left, int right) {
97109703
if ((float_nf != null) &&

0 commit comments

Comments
 (0)