public class Format
extends java.lang.Object
| Constructor and Description |
|---|
Format() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
d(double d,
int min_sigfig)
Double value formatting with minimum number of significant figures in a minimum width.
|
static java.lang.String |
d(double d,
int min_sigfig,
int width)
Double value formatting with minimum number of significant figures in a specified width.
|
static java.lang.String |
dfrac(double d,
int fixed_decimals)
Double value formatting with fixed number of digits to the right of the decimal point.
|
static java.lang.String |
formatByteSize(double size)
Nicely formatted representation of bytes, eg turn 5.636E7 into '56.3 Mbytes'.
|
static java.lang.String |
formatDouble(double d,
int min_sigFigs,
int fixed_decimals)
Format a double value
|
static java.lang.String |
i(int v,
int width)
Format an integer value.
|
static java.lang.String |
l(long v,
int width)
Format a long value.
|
static java.lang.String |
pad(java.lang.String s,
int width,
boolean rightJustify)
Create a new string by padding the existing one with blanks to specified width.
|
static java.lang.String |
s(java.lang.String s,
int width)
Create a new string by padding the existing one with blanks to specified width.
|
static void |
tab(java.lang.StringBuffer sbuff,
int tabStop,
boolean alwaysOne)
Blank fill sbuff with blanks, until position tabStop.
|
static void |
tab(java.lang.StringBuilder sbuff,
int tabStop,
boolean alwaysOne)
Blank fill sbuff with blanks, until position tabStop.
|
public static void tab(java.lang.StringBuffer sbuff,
int tabStop,
boolean alwaysOne)
sbuff - StringBuffer to manipulatetabStop - pad out to herealwaysOne - true if you want to guarentee at least one space.public static void tab(java.lang.StringBuilder sbuff,
int tabStop,
boolean alwaysOne)
sbuff - StringBuilder to manipulatetabStop - pad out to herealwaysOne - true if you want to guarentee at least one space.public static java.lang.String s(java.lang.String s,
int width)
s - string to padwidth - length of return stringpublic static java.lang.String pad(java.lang.String s,
int width,
boolean rightJustify)
s - string to padwidth - length of return stringrightJustify - if true, right justify, else left justifypublic static java.lang.String i(int v,
int width)
v - : valuewidth - pad to this widthpublic static java.lang.String l(long v,
int width)
v - : valuewidth - pad to this widthpublic static java.lang.String d(double d,
int min_sigfig)
d - the number to format.min_sigfig - minimum number of significant figurespublic static java.lang.String d(double d,
int min_sigfig,
int width)
d - the number to format.min_sigfig - minimum number of significant figureswidth - width of the resultpublic static java.lang.String dfrac(double d,
int fixed_decimals)
d - the number to format.fixed_decimals - number of digits to the right of the decimal pointpublic static java.lang.String formatDouble(double d,
int min_sigFigs,
int fixed_decimals)
d - value to formatmin_sigFigs - minimum significant figuresfixed_decimals - number of fixed decimalspublic static java.lang.String formatByteSize(double size)
size - the size in bytes