planetj.formatters
Class StringFormatter

java.lang.Object
  |
  +--planetj.formatters.StringFormatter
All Implemented Interfaces:
IFormatter

public class StringFormatter
extends Object
implements IFormatter

Provide static methods to position or center a String within a given width. Creation date: (4/22/2002 2:56:09 PM)


Constructor Summary
StringFormatter()
           
 
Method Summary
static String center(String s, int width)
          Place spaces around s to center it within width characters.
 Object formatValue(Object value)
          Insert the method's description here.
static String leftAdjust(String s, int width)
          Pad out s with spaces after it.
static String rightAdjust(String pString, int pWidth)
          Pad out s with spaces before it.
static String spaceApartStrings(String pLeftString, String pRightString, int pTotalWidth)
          Inserts spaces between two Strings until the Stirng.length() = pWidth Creation date: Jun 11, 2004 11:54:59 AM
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringFormatter

public StringFormatter()
Method Detail

center

public static String center(String s,
                            int width)
Place spaces around s to center it within width characters. Creation date: (4/22/2002 2:56:36 PM)


formatValue

public Object formatValue(Object value)
Description copied from interface: IFormatter
Insert the method's description here. Creation date: (12/1/2001 4:40:45 PM)

Specified by:
formatValue in interface IFormatter
Parameters:
value - java.lang.Object
Returns:
java.lang.Object

leftAdjust

public static String leftAdjust(String s,
                                int width)
Pad out s with spaces after it. Creation date: (4/22/2002 2:57:02 PM)


rightAdjust

public static String rightAdjust(String pString,
                                 int pWidth)
Pad out s with spaces before it. Creation date: (4/22/2002 2:57:28 PM)


spaceApartStrings

public static String spaceApartStrings(String pLeftString,
                                       String pRightString,
                                       int pTotalWidth)
Inserts spaces between two Strings until the Stirng.length() = pWidth Creation date: Jun 11, 2004 11:54:59 AM