wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Converting to Float Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Converting to Float" Watch "Converting to Float" New topic
Author

Converting to Float

Brian Cummins
Greenhorn

Joined: Feb 24, 2005
Posts: 11
Hi. My price value is read in from a file as a float value. I then convert this to local currency and then to String using this code:



However, my problem is when i am trying to save this value again. The value has to be saved as a Float. Is there any way of taking out the � sign so that i can convert it back to a Float.
M Beck
Ranch Hand

Joined: Jan 14, 2005
Posts: 323
Originally posted by Brian Cummins:
Hi. My price value is read in from a file as a float value. I then convert this to local currency and then to String using this code:



However, my problem is when i am trying to save this value again. The value has to be saved as a Float. Is there any way of taking out the � sign so that i can convert it back to a Float.


you're converting a BigDecimal to a string, and then you want to convert the string to a float... why can't you just convert the BigDecimal to a float directly?
Brian Cummins
Greenhorn

Joined: Feb 24, 2005
Posts: 11
I have to convert it to a string first to display it in the textbox
M Beck
Ranch Hand

Joined: Jan 14, 2005
Posts: 323
yes, but that doesn't make the BigDecimal go away, does it?
 
GeeCON Prague 2014
 
subject: Converting to Float