I have a csv file. I am reading each line from this and writing to another file. I am doing it using StringTokenizer. My problem is: I wanted to count no of tokens in a string. IF number of tokens in a particular row is less than 19, some error message has to be displayed. I thought of using String.split() but, i am not sure, like which class i should import to do the same.
StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.
Have you investigated String's split method? Have you checked out package java.util.regex? I suggest you do these three things, in that order.