mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 21:59:20 +01:00
Returning code at top of INT NUMBER FORMATTING to prior state
This commit is contained in:
@@ -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 <a href="https://processing.org/reference/intconvert_.html">int(float)</a>
|
||||
*/
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user