![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Aug 2005
Posts: 22
Rep Power: 0
![]() |
Error handling inputs
What would you guys recommend as being the best way to error handle precise inputs?
for example my program ask the user for a date, which must be of the form '2006-03-11' (yyyy-mm-dd) it also asks for a location and destination. Is there anyways I can check for dodgy inputs such as 'asadsddddddewrew' Many thanks, |
|
|
|
|
|
#2 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 754
Rep Power: 3
![]() |
What kind of user interface do you have? Console? Swing? Either way, for the date, I'd suggest taking a look at the DateFormat class. For the other inputs, it depends on if you have a known set of locations or if the user can input anywhere they want (like Ulaanbaatar, or Ouagadougou).
|
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
ROFL, Jimbo! You made me Google those! Ulaanbaatar is my favorite, I'm goin' if it's the last thing I do!
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
SimpleDateFormat would seem to be the class to use for parsing dates.
|
|
|
|
|
|
#5 | |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 754
Rep Power: 3
![]() |
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|