org.ifeth.sehr.lib
Class StringFormat

java.lang.Object
  extended byjava.text.Format
      extended byorg.ifeth.sehr.lib.StringFormat
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class StringFormat
extends java.text.Format

"String formatter"; format a string to a given maximum length with left, centre, or right justification.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.text.Format
java.text.Format.Field
 
Field Summary
static int JUST_CENTER
           
static int JUST_CENTRE
           
static int JUST_LEFT
           
static int JUST_RIGHT
          Constant for right-justified Strings.
 
Constructor Summary
StringFormat(int maxChars, int just)
           
 
Method Summary
 java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer where, java.text.FieldPosition ignore)
          Format a String
static boolean isNULLOrEmpty(java.lang.String s)
          Check if a string is null or empty.
 java.lang.Object parseObject(java.lang.String arg0, java.text.ParsePosition arg1)
           
static java.lang.String replace(java.lang.String str, java.lang.String pattern, java.lang.String replace)
          Replaces a substring in a string Usable for JRE 1.4.x because JRE 1.5 can handle this
static java.lang.String trimNULL(java.lang.String s)
          Helper method to set 'null' strings to "" strings for a better review from database.
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JUST_LEFT

public static final int JUST_LEFT
See Also:
Constant Field Values

JUST_CENTRE

public static final int JUST_CENTRE
See Also:
Constant Field Values

JUST_CENTER

public static final int JUST_CENTER
See Also:
Constant Field Values

JUST_RIGHT

public static final int JUST_RIGHT
Constant for right-justified Strings.

See Also:
Constant Field Values
Constructor Detail

StringFormat

public StringFormat(int maxChars,
                    int just)
Method Detail

format

public java.lang.StringBuffer format(java.lang.Object obj,
                                     java.lang.StringBuffer where,
                                     java.text.FieldPosition ignore)
Format a String


isNULLOrEmpty

public static boolean isNULLOrEmpty(java.lang.String s)
Check if a string is null or empty.

Note: The method is static so it can be used by other classes :)


trimNULL

public static java.lang.String trimNULL(java.lang.String s)
Helper method to set 'null' strings to "" strings for a better review from database. If string is not null the string itself is returned trimmed.

Note: The method is static so it can be used by other classes :)

Returns:
string

replace

public static java.lang.String replace(java.lang.String str,
                                       java.lang.String pattern,
                                       java.lang.String replace)
Replaces a substring in a string

Usable for JRE 1.4.x because JRE 1.5 can handle this

Parameters:
str -
pattern -
replace -
Returns:

parseObject

public java.lang.Object parseObject(java.lang.String arg0,
                                    java.text.ParsePosition arg1)