*
The moose likes Beginning Java and the fly likes Check the String for a Date OR Number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Check the String for a Date OR Number" Watch "Check the String for a Date OR Number" New topic
Author

Check the String for a Date OR Number

smitha rai
Ranch Hand

Joined: Aug 15, 2001
Posts: 33
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

Joined: Jul 22, 2000
Posts: 9044
    
  10
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.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Check the String for a Date OR Number
 
Similar Threads
conversion of date
How to change Date Format
Date conversion to String- urgent help!
How can I sort an array of strings, but not by 1st character?
Linebreaks inside select pull down