Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

proper format

Thread view: 
gk - 27 Dec 2005 11:18 GMT
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 ?
zero - 27 Dec 2005 19:07 GMT
"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

Viator - 27 Dec 2005 20:54 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.
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

:)
drwsh - 30 Dec 2005 14:25 GMT
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 ?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.