• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Check the String for a Date OR Number

 
smitha rai
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to Java and I want to know the given string is a string or number or in date format (say, dd-mm-yyyy OR mm/dd/yyyy, etc). Appreciate if any one help me out with a code?
Thanks and regards,
Smitha
 
Marilyn de Queiroz
Sheriff
Posts: 9062
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use the Character.isDigit(char) method of the Character class. It determines if the specified character is a digit and returns a boolean result.
 
Marilyn de Queiroz
Sheriff
Posts: 9062
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Smitha,
An underscore is not the same as a space. Please read http://www.javaranch.com/name.jsp and re-register. We would like you to continue to post here at JavaRanch.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic