Hi Gan,
I had a small problem,
For the I18n of my application, I need to format the monitory values
depending on the Locale.
Here is the simple code I am using.
double myNumber = -1234.56;
DecimalFormat form = new DecimalFormat();
// just for fun, we print out a number with the locale number, currency
// and percent format for each locale we can.
FileWriter fw = new FileWriter("testjava.out");
Try{
fw.write("\n FORMAT");
for (int i = 0; i < locales.length; i++ )
{
if (locales[i].getCountry().length() == 0) {
// skip language-only
continue;
}
form =
(DecimalFormat)NumberFormat.getCurrencyInstance(locales[i]);
DecimalFormatSymbols df =
form.getDecimalFormatSymbols();
df.setCurrencySymbol("");
df.setInternationalCurrencySymbol("");
df.setMonetaryDecimalSeparator('D');
form.setDecimalFormatSymbols(df);
fw.write("\t Decimal char: "+
form.getDecimalFormatSymbols().getCurrencySymbol()+"\t: " + "\t -> "+
form.format(myNumber));
}
fw.close();
}
catch(Exception ex){}
My problem is As follow.
Above returns me as follow:
For Example :
For Locale Arabic (United Arab Emirates) it returns me ?.?.?
1,234D56- but I don't need ?.?.? , I believe it is a Currency Symbol,
I need only 1,234D56-
If any body has the solution then please, help me.
Thanks for your time,
Hemant
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
Removing the Currency Symbole form the Currency Number Format
Gajjar Hemant Kumar Dashrathlal Fri, 11 Feb 2000 17:05:42 -0800
