This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to cast a string into a float? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to cast a string into a float?" Watch "How to cast a string into a float?" New topic
Author

How to cast a string into a float?

George Ren
Ranch Hand

Joined: Aug 17, 2002
Posts: 58
I want to make a string like "123" to a float number like 123.000. How can I achieve this? Thanks for help!

Regards,
Have a nice day!


THINK!
jim gotti
Ranch Hand

Joined: Jul 02, 2002
Posts: 36
Float.parseFloat(String) may help?


If you need to keep the precision of 3 decimals this thread may help
George Ren
Ranch Hand

Joined: Aug 17, 2002
Posts: 58
Thanks a lot. It does work
 
GeeCON Prague 2014
 
subject: How to cast a string into a float?