Results 1 to 2 of 2
Thread: Validating for length of String
- 10-11-2009, 08:46 AM #1
Member
- Join Date
- Apr 2008
- Posts
- 88
- Rep Power
- 0
Validating for length of String
Hey guys,
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.
Similar Threads
-
validating account
By ServletEst in forum Java ServletReplies: 3Last Post: 08-24-2009, 01:11 PM -
Using PadRight but want to actually cut the string off at that length
By matpj in forum New To JavaReplies: 1Last Post: 01-14-2009, 05:19 PM -
[SOLVED] String Length issue.
By ChrisMayhew in forum New To JavaReplies: 7Last Post: 01-11-2009, 03:16 AM -
Finding the exact length of a string in a JLabel (in pixels)
By Clarkey in forum Advanced JavaReplies: 2Last Post: 03-25-2008, 05:49 AM -
validating a string for numbers and letters?
By lockmac in forum New To JavaReplies: 1Last Post: 08-09-2007, 09:17 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks