Java Reference
In-Depth Information
24.3. Currency
Currency encoding is highly sensitive to locale, and the java.util.Currency
class helps you properly format currency values. You obtain a Currency
object from one of its static getInstance methods, one of which takes a
Locale object while the other takes a currency code as a String (codes are
from the ISO 4217 standard).
The Currency class does not directly map currency values into localized
strings but gives you information you need to do so. The information at
your disposal is
public String getSymbol()
Returns the symbol of this currency for the default locale.
public String getSymbol(Locale locale)
Returns the symbol of this currency for the specified locale. If
there is no locale specific symbol then the ISO 4217 currency
code is returned. Many currencies share the same symbol in
their own locale. For example, the $ symbol represents U.S.
dollars in the United States, Canadian dollars in Canada, and
Australian dollars in Australiato name but a few. The local cur-
rency symbol is usually reserved for the local currency, so each
locale can change the representation used for other currencies.
For example, if this currency object represents the U.S. dol-
lar, then invoking getSymbol with a U.S locale will return "$" be-
cause it is the local currency. However, invoking getSymbol with
a Canadian locale will return "USD" (the currency code for the
U.S. dollar) because the $ symbol is reserved for the Canadian
dollar in the Canadian locale.
public int geTDefaultFractionDigits()
 
Search WWH ::




Custom Search