Your code makes the excellent argument of why you should use an array of objects instead of variables... you could seriously cut the number of lines of code and use that to iterate on instead of listing everything one at a time.
I think what you really want to use is java.lang.String.spilt() which given a regular expression splits the entry into an array of elements based on the regular expression. Then, you would just have to check that the array created by split has exactly 17 elements.
But still, I think the first step is to get rid of your long list of variables then have an array. If you prefer String Tokenizer (which I don't recommend here) then you could just iterate on the elements calling hasMoreTokens() repeatedly checking keeping a count of how many elements were found. Its *ALWAYS* a good idea to call StringTokenizer.hasMoreTokens() before calling StringTokenizer.nextToken(). [ November 13, 2005: Message edited by: Scott Selikoff ]
thanks Ash, I wanted to know, how to import this StringUtils class? My program is giving some error as "Unable to compile class JSP import java.StringUtils.*; " Can you please help me in this regard ???
Joined: Mar 17, 2005
Thanks to everyone. I am using seperate variable because, my programs requires it....Otherwise i would have considered your idea of using iteration and array.
I am using "StringTokenizer.hasMoreTokens()" before using "StringTokenizer.nextToken()"
To use Split() method, which class should i import? I am implementing all these in a JSP page.