Results 1 to 2 of 2
Thread: Validating for length of String
- 10-11-2009, 08:46 AM #1Member
- Join Date
- Apr 2008
- Rep Power
Validating for length of String
I am following the project requirements for our first java project at school. One of the requirements is to validate it so that STATE cannot be blank and must have no more than two letters (like CA for california)
I know how to validate for making sure the field is not blank but how about validating to make sure it is two characters long?
Thanks, so far I have a "Customer" class that creates a Customer constructor, setters, getters, and returns a summary. Now I'm working on the validation and I've validated Firstname, last, address to make sure the fields are not blank.
SOLVED the syntax is aCust.state.length != 2 where aCust is the object.
Last edited by Bascotie; 10-11-2009 at 08:52 AM. Reason: solved
Glad to hear that you've solved this problem.
- By ServletEst in forum Java ServletReplies: 3Last Post: 08-24-2009, 01:11 PM
- By matpj in forum New To JavaReplies: 1Last Post: 01-14-2009, 06:19 PM
- By ChrisMayhew in forum New To JavaReplies: 7Last Post: 01-11-2009, 04:16 AM
- By Clarkey in forum Advanced JavaReplies: 2Last Post: 03-25-2008, 06:49 AM
- By lockmac in forum New To JavaReplies: 1Last Post: 08-09-2007, 09:17 AM