Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to convert from String to Integer?

 
qionghua yang
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I have this String "12" and I would like to have an Integer. Is there any easy way to cast or convert it to an Integer? Thanks!
qionghua
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Integer.parseInt("12").
-Peter
 
qionghua yang
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,
It works. Thanks a lot!
qionghua
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic