shared.formatting
Class CurrencyFormatter

java.lang.Object
  extended by shared.formatting.CurrencyFormatter

public class CurrencyFormatter
extends java.lang.Object

This class reformats currency values into a standard form.

This class has no instance data. It exposes a single static method, reformat, which replaces leading or trailing minus signs with surrounding parentheses, adds a leading zero to quantities starting with a decimal point, and prepends a currency symbol.


Constructor Summary
CurrencyFormatter()
           
 
Method Summary
static java.lang.String reformat(java.lang.String amount)
          Reformat currency strings into standard form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurrencyFormatter

public CurrencyFormatter()
Method Detail

reformat

public static java.lang.String reformat(java.lang.String amount)
Reformat currency strings into standard form.

This is done by:

  1. Removing surrounding blanks.
  2. Prepending a currency symbol.
  3. Replacing a leading or trailing "-" with surrounding parens.
  4. Adding a leading zero to zero amounts without leading digits.

Parameters:
amount - currency string to reformat
Returns:
reformatted currency