shared.formatting
Class CurrencyFormatter
java.lang.Object
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.
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 |
CurrencyFormatter
public CurrencyFormatter()
reformat
public static java.lang.String reformat(java.lang.String amount)
- Reformat currency strings into standard form.
This is done by:
- Removing surrounding blanks.
- Prepending a currency symbol.
- Replacing a leading or trailing "-" with surrounding parens.
- Adding a leading zero to zero amounts without leading digits.
- Parameters:
amount
- currency string to reformat
- Returns:
- reformatted currency