Class FormatStringBuffer

java.lang.Object
org.openscience.cdk.tools.FormatStringBuffer

public class FormatStringBuffer extends Object
A class for formatting output similar to the C printf 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 Details

    • FormatStringBuffer

      public FormatStringBuffer(String format)
      Create a new FormatStringBuffer.
      Parameters:
      format - the format string.
  • Method Details

    • reset

      public FormatStringBuffer reset(String format)
      Reset this FormatStringBuffer.
      Parameters:
      format - the format string.
    • reset

      public FormatStringBuffer reset()
      Reset this FormatStringBuffer with the format string given in the constructor or last call to reset(String). This is automatically called after toString().
    • format

      public FormatStringBuffer format(char ch)
      Format a char.
    • format

      public FormatStringBuffer format(float flt)
      Format a float.
    • format

      public FormatStringBuffer format(double dbl)
      Format a double.
    • format

      public FormatStringBuffer format(int i)
      Format a float.
    • format

      public FormatStringBuffer format(long l)
      Format a float.
    • format

      public FormatStringBuffer format(String str)
      Format a String.
    • toString

      public String toString()
      Get the result of the formatting. reset() is automatically called from this method.
      Overrides:
      toString in class Object