File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to convert string to number?

 
Mr Tan Ah Seng
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need help.

I use Integer.parseInt to convert string in integer format(example 123) to integer number without problem.

However, I have problem using Integer.parseInt to convert a string in float number format(example 1.23) to float number, so that I can use it for calculation.

Thanks.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12017
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can't use Integer.parseInt to get a float - it returns an int!!!

but i bet you COULD use Float.parseFloat...
 
Mr Tan Ah Seng
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I can do it now.
Thanks for your help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic