Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formatted input

Status
Not open for further replies.

dilse

Programmer
Jul 21, 2001
6
IN
I am supposed to get the inputs from a file .The inputs are integers , Strings ,longs and date-time. Is there any trick to validate that the inputs are in proper format .If not then an error message should flash.
The program should not be in servlet or jsp.

Please Help........
 
afraid not. for example, 63 can be a long, int, char or a string. and dates are the worst thing in the world..literally as they are local specific.

i afraid your going to have to do all the validation yourself. :(

Welcome to the real world :)
 
Hi Dilse,

There are ways to do that. However, it will depend on your requirements so perhaps you would like to explain in more detail the exact requirement? Like if the inputs are supposed to be in a line or if there is any sequence to the data in the file (e.g. a int value will definately be followed by a String and then followed by a long) etc.

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Hi.

Maybe a good and fast way to implement validations on your intput is to use a lexer/parser generated by a specific tool like ANTLR(see : Especially if you have complex inputs, I think it could a great solution. ANTLR offers you a great control on errors.

Bye. --
Globos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top