Hi, I am reading a String with "," as delimiter. I use StringTokenizer to read values from String. But there is a chance that I get no values for some tokens . eg: 111,222,,444,,666 I have a problem in reading empty tokens. StringTokenizer class is not considering empty tokens. I get output as 111 222 444 666 Is there anyway I get that null values? Please advice me. Thanks, Ram
I ran into a similar problem using a pipe-delimeted record format using jdk1.3. The only way I was able to resolve this issue was to construct a StringTokenizer where the delimeters are also counted as tokens, and adding logic to find adjacent tokens (which have no value between them), and also for the 1st and last valuebeing null (in which the 1st or last charater of the string is also a delimeter) Here is the code I came up with.... P.S. The code actually creates a hashmap with the key being the Integer position of the token, and the value being the token.