Package org.openscience.cdk.tools
Class FormatStringBuffer
- java.lang.Object
-
- org.openscience.cdk.tools.FormatStringBuffer
-
public class FormatStringBuffer extends Object
A class for formatting output similar to the Cprintf
command.Some features provided by ANSI C-standard conformant
printfs
are not supported because of language constraints.Supported conversion specifiers are: 'c', 'd', 'e', 'E', 'f', 'g' (works like 'f'), 'i', 'o', 's', 'x' and 'X'.
Supported conversion flags are: '#', '0', '-', ' ' (a space) and '+'.
Support for conversion flag '*' is under development.
- Version:
- 1.7
- Author:
- Antti S. Brax (asb@iki.fi, base implementation), Fred Long (flong(AT)skcc.org, implemented 'e', 'E' and 'g')
- Source code:
- main
- Belongs to CDK module:
- standard
- License:
- BSD
-
-
Constructor Summary
Constructors Constructor Description FormatStringBuffer(String format)
Create a newFormatStringBuffer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormatStringBuffer
format(char ch)
Format achar
.FormatStringBuffer
format(double dbl)
Format adouble
.FormatStringBuffer
format(float flt)
Format afloat
.FormatStringBuffer
format(int i)
Format afloat
.FormatStringBuffer
format(long l)
Format afloat
.FormatStringBuffer
format(String str)
Format aString
.FormatStringBuffer
reset()
Reset thisFormatStringBuffer
with the format string given in the constructor or last call toreset(String)
.FormatStringBuffer
reset(String format)
Reset thisFormatStringBuffer
.String
toString()
Get the result of the formatting.
-
-
-
Constructor Detail
-
FormatStringBuffer
public FormatStringBuffer(String format)
Create a newFormatStringBuffer
.- Parameters:
format
- the format string.
-
-
Method Detail
-
reset
public FormatStringBuffer reset(String format)
Reset thisFormatStringBuffer
.- Parameters:
format
- the format string.
-
reset
public FormatStringBuffer reset()
Reset thisFormatStringBuffer
with the format string given in the constructor or last call toreset(String)
. This is automatically called aftertoString()
.
-
format
public FormatStringBuffer format(char ch)
Format achar
.
-
format
public FormatStringBuffer format(float flt)
Format afloat
.
-
format
public FormatStringBuffer format(double dbl)
Format adouble
.
-
format
public FormatStringBuffer format(int i)
Format afloat
.
-
format
public FormatStringBuffer format(long l)
Format afloat
.
-
format
public FormatStringBuffer format(String str)
Format aString
.
-
-