Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Converting a string to an int

 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my code for booking a seat I have
availableSeat.getText() < purchaseFlightSeats.getText()
The problem is cant convert int to String but I need to this to compare the number of seats available to the number the client wishes to purchase..
Any Suggestions???
Thanks Lisa
 
Ajit Kumar
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
new Integer(string).intValue();
 
Rudy Yeung
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lisa,
You can also use Integer static method without instantiating an Integer object like Integer.parseInt(string).
Rudy
 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks you very much.
Moving right along..
Lisa
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic