i want my user should input data in this format "dd/MM/yyyy HH:mm:ss" .
if not i want to show him a message to enter input in that proper
format . how ?
"gk" <srcjnu@gmail.com> wrote in news:1135682337.452055.265630
@g47g2000cwa.googlegroups.com:
> i want my user should input data in this format "dd/MM/yyyy HH:mm:ss" .
> if not i want to show him a message to enter input in that proper
> format . how ?
You can use regular expressions.
use
class Pattern:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html
and class Matcher:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Matcher.html
or String:matches(String regex)
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#matches
(java.lang.String)
The javadoc for class Pattern shows how to construct regular expressions.
Basically you get the input string, match it against a regular expression,
and if it doesn't match, tell the user to try again.

Signature
Beware the False Authority Syndrome
Can you please spare a bit of time to explain YOUR problem. Where are
you gettign the data(input) from. What kind of user interface it is.
Where do you show the message. Do you want to strict the user to enter
only allowed format or you want to check the format after entry is done.
Luc The Perverse - 27 Dec 2005 21:58 GMT
> Can you please spare a bit of time to explain YOUR problem. Where are
> you gettign the data(input) from. What kind of user interface it is.
> Where do you show the message. Do you want to strict the user to enter
> only allowed format or you want to check the format after entry is done.
Likewise, please take time to quote the person you are replying to ;)
--
LTP
:)
test
"gk" <srcjnu@gmail.com>
??????:1135682337.452055.265630@g47g2000cwa.googlegroups.com...
>i want my user should input data in this format "dd/MM/yyyy HH:mm:ss" .
> if not i want to show him a message to enter input in that proper
> format . how ?