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