• Post Reply Bookmark Topic Watch Topic
  • New Topic

Parsing etc etc etc  RSS feed

 
Varun Goenka
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please teach me to use the parse method to read dates,
Also please list the method types that return boolean values that tell wether the string has certain elements or not.

As in : object.hasNextSomething() OR isSomething()---->(eg: isFloat()).


Please help.
 
Eric Daly
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I think you're talking about using the Scanner class, which you can find all the details about it here.
That's what you're probably using to parse your input. This lists all the methods and what they do.
As in : object.hasNextSomething() OR isSomething()---->(eg: isFloat()).

Well the Scanner API has methods like scannerObject.hasNextInt(), but there is no method for the other thing you want, isFloat(). However, the way to check this is by using the instanceof operator. You might say something like

Here's some info about instanceof.
Hope that helps.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For parsing strings into Date objects, read the Java API documentation of the class SimpleDateFormat.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!