Java Formatter

Home arrow Java Tutorials arrow Tips arrow Java Formatter
Java Formatter Print E-mail
Contributed by Joe   
Tuesday, 18 July 2006

Creating a Formatter

The simplest way to get started with the Formatter class is to create a new instance of it.

Below are Formatter constructors


 // No-args version -- not particularly useful

 public Formatter( );

 // Basically, the no-args version with a locale

 public Formatter(Locale l);

 // Creates a formatter with the supplied destination (sink)

 public Formatter(Appendable a);

 // Creates a formatter with the destination, using the supplied locale

 public Formatter(Appendable a, Locale l);

 // Creates a new formatter with the filename as the sink

 public Formatter(String fileName);

 // Creates a new formatter with a file as the sink, using the specified charset

 public Formatter(String fileName, String csn);

 // Same as above, but with a locale

 public Formatter(String fileName, String csn, Locale l); 

 StringBuilder sb = new StringBuilder( );
 Formatter formatter = new Formatter(sb, Locale.FRANCE);

Last Updated ( Tuesday, 18 July 2006 )

  home              contact us

 

©2006-2008 DeveloperZone.biz   All rights reserved     powered by Mambo Designed by Siteground