Ok,

The reason I wasparsing it back in was to convert it from a String to
an integer. I think I have fixed part of the problem. My code now
looks like this:

NumberFormat fmt = NumberFormat.getCurrencyFormat();
String formatted = fmt.format(discountAmount);
discountAmount = Integer.parse(formatted);

However, it now comes up with US$2.57...How do I get it to remove the
US$ part?!

Regards,
Jack

On Mar 17, 6:38 pm, MN <[email protected]> wrote:
> please provide your full code.
>
> you print out formatted oder discountAmount?
> why you parse again the formatted string back to discountAmount?
>
> On 17 Mrz., 15:18, "[email protected]"
>
> <[email protected]> wrote:
> > Hi,
>
> > I am having some problems correctly displaying currency. Here is the
> > code I am using:
>
> > //Format the discount to two decimal places
> > NumberFormat fmt = NumberFormat.getCurrencyFormat();
> > String formatted = fmt.format(discountAmount);
> > discountAmount = NumberFormat.getCurrencyFormat().parse(formatted);
>
> > The discount amount field is set to some currency value for example
> > 2.58888. Now, it works fine if the value is set to 2 or more decimal
> > places, so it would format 2.58888 to 2.58. However, if the value is
> > intitial set to say 3, it formats the value to 3.0!
>
> > Now, as I am using this to display the price of something, £3.0 is not
> > really much use. Can someone see where I am going wrong in my code or
> > if I need to add something??
>
> > Cheers,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to