oracle.clex.util
Class FormatUtility

java.lang.Object
  |
  +--oracle.clex.util.FormatUtility
All Implemented Interfaces:
java.io.Serializable

public class FormatUtility
extends java.lang.Object
implements java.io.Serializable

Utility class providing methods for formating.

See Also:
Serialized Form

Field Summary
static char SPACE
           
static char ZERO
           
 
Constructor Summary
FormatUtility()
           
 
Method Summary
static java.lang.String center(java.lang.String a_string, int a_width, char a_padCharacter)
          Center a string within a specified width and padded on either side if necesary.
static java.lang.String formatCalendarDate(java.util.Calendar a_calendar)
          Format a Calendar date into a String date in mm/dd/yyyy format.
static java.lang.String formatCurrency(double d)
          Formats a double using java.text.NumberFormat.getCurrencyInstance(Locale.US)
static java.lang.String formatCurrency(java.lang.Double d)
          Formats a Double using java.text.NumberFormat.getCurrencyInstance(Locale.US)
static java.lang.String formatCurrency(java.lang.Integer i)
          Formats a Integer using java.text.NumberFormat.getCurrencyInstance(Locale.US)
static java.lang.String formatDateString(java.lang.String a_dateString)
          Format a String date in either yyyymmdd or yymmdd into a String date in mm/dd/yyyy.
static java.lang.String formatDouble(double d)
          Formats a Integer using java.text.NumberFormat.getCurrencyInstance(Locale.US)
static java.lang.String formatDouble(double d, int decPlaces, boolean groupingUsed)
          Formats a double using java.text.NumberFormat.getInstance()
static java.lang.String formatLongCalendarTimeToString(java.util.Calendar a_calendar)
          Format a Calendar date into a String date in hh:mm:ss format.
static java.lang.String formatLongDateString(java.lang.String a_longDateString)
          Format a String date in yyyymmdd into a String date in mm/dd/yyyy.
static java.lang.String formatShortDateString(java.lang.String a_dateString)
          Format a String date in yymmdd into a String date in mm/dd/yyyy.
static java.lang.String formatShortTimeString(java.lang.String a_shortTimeString)
          Format a String time in hhmm into a String time in hh:mm.
static java.util.Calendar formatStringToCalendarDate(java.lang.String a_date)
          Format a String date with format mm/dd/yyyy into a Calendar date.
static java.lang.String formattedCurrentDate()
          Formats the current date to mm/dd/yyyy format
static int formatToJulianDate(java.util.Calendar cal)
          Formats a Calendar into a Julian date
static java.lang.String formatToSQLDate(java.util.Calendar a_calendar)
          Format a Calendar date into a String date in 'DD-MON-YYYY' format.
static java.lang.String leftJustify(java.lang.String a_string, int a_width, char a_padCharacter)
          If the width of "a_string" is less than "a_width" then it is padded with "a_padCharacter" else if the width is greater than "a_width" then empty String is returned
static void main(java.lang.String[] a_args)
           
static java.lang.String rightJustify(long a_longToFormat, int a_width, char a_padCharacter)
          If the width of "a_longToFormat" is less than a_width then it is padded with "a_padCharacter" else if the width is greater than "a_width" then empty String is returned
static java.lang.String rightJustify(java.lang.String a_string, int a_width, char a_padCharacter)
          If the width of "a_string" is less than "a_width" then it is padded with "a_padCharacter" else if the width is greater than "a_width" then empty String is returned
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO

public static final char ZERO

SPACE

public static final char SPACE
Constructor Detail

FormatUtility

public FormatUtility()
Method Detail

rightJustify

public static java.lang.String rightJustify(long a_longToFormat,
                                            int a_width,
                                            char a_padCharacter)
If the width of "a_longToFormat" is less than a_width then it is padded with "a_padCharacter" else if the width is greater than "a_width" then empty String is returned
Parameters:
long - - The long that needs to be formated
int - - The total width of the returned string
Char - - The Character that will be used to pad the string
Returns:
String - Formated long as String

rightJustify

public static java.lang.String rightJustify(java.lang.String a_string,
                                            int a_width,
                                            char a_padCharacter)
If the width of "a_string" is less than "a_width" then it is padded with "a_padCharacter" else if the width is greater than "a_width" then empty String is returned
Parameters:
long - - The long that needs to be formated
int - - The total width of the returned string
Char - - The Character that will be used to pad the string
Returns:
String - Formated long as String

leftJustify

public static java.lang.String leftJustify(java.lang.String a_string,
                                           int a_width,
                                           char a_padCharacter)
If the width of "a_string" is less than "a_width" then it is padded with "a_padCharacter" else if the width is greater than "a_width" then empty String is returned
Parameters:
long - - The long that needs to be formated
int - - The total width of the returned string
Char - - The Character that will be used to pad the string
Returns:
String - Formated long as String

formatDateString

public static java.lang.String formatDateString(java.lang.String a_dateString)
Format a String date in either yyyymmdd or yymmdd into a String date in mm/dd/yyyy.

formatShortDateString

public static java.lang.String formatShortDateString(java.lang.String a_dateString)
Format a String date in yymmdd into a String date in mm/dd/yyyy.

formatLongDateString

public static java.lang.String formatLongDateString(java.lang.String a_longDateString)
Format a String date in yyyymmdd into a String date in mm/dd/yyyy.

formatShortTimeString

public static java.lang.String formatShortTimeString(java.lang.String a_shortTimeString)
Format a String time in hhmm into a String time in hh:mm.

formatStringToCalendarDate

public static java.util.Calendar formatStringToCalendarDate(java.lang.String a_date)
Format a String date with format mm/dd/yyyy into a Calendar date.

formatCalendarDate

public static java.lang.String formatCalendarDate(java.util.Calendar a_calendar)
Format a Calendar date into a String date in mm/dd/yyyy format.

formatLongCalendarTimeToString

public static java.lang.String formatLongCalendarTimeToString(java.util.Calendar a_calendar)
Format a Calendar date into a String date in hh:mm:ss format.

formatToJulianDate

public static int formatToJulianDate(java.util.Calendar cal)
Formats a Calendar into a Julian date

formatToSQLDate

public static java.lang.String formatToSQLDate(java.util.Calendar a_calendar)
Format a Calendar date into a String date in 'DD-MON-YYYY' format.

formatCurrency

public static java.lang.String formatCurrency(double d)
Formats a double using java.text.NumberFormat.getCurrencyInstance(Locale.US)

formatCurrency

public static java.lang.String formatCurrency(java.lang.Double d)
Formats a Double using java.text.NumberFormat.getCurrencyInstance(Locale.US)

formatCurrency

public static java.lang.String formatCurrency(java.lang.Integer i)
Formats a Integer using java.text.NumberFormat.getCurrencyInstance(Locale.US)

formatDouble

public static java.lang.String formatDouble(double d)
Formats a Integer using java.text.NumberFormat.getCurrencyInstance(Locale.US)

formatDouble

public static java.lang.String formatDouble(double d,
                                            int decPlaces,
                                            boolean groupingUsed)
Formats a double using java.text.NumberFormat.getInstance()

formattedCurrentDate

public static java.lang.String formattedCurrentDate()
Formats the current date to mm/dd/yyyy format

center

public static java.lang.String center(java.lang.String a_string,
                                      int a_width,
                                      char a_padCharacter)
Center a string within a specified width and padded on either side if necesary. Does nothing if string length is greater than width.

main

public static void main(java.lang.String[] a_args)


Copyright © 2003 ORACLE Corp. All Rights Reserved.