Hi I need to tokenize a string with ',' as delimiter. for example in the string below: Sreeni, san, 12345, , #44 XYZ street,,234567 Here I need to tokenize with comma as delimiter. The problem is with the value is not specified and instead when ,, is specified. The StringTokenizer skips this as a value, whereas , , is returned as blank. How do I overcome this problem, when ,, is specified. Note: comma character in the above string is not a value. Thanks Sreeni
Hi sreeni. I have tried to solve ur problem.You can have other logic for this also.What i have done in this function is that i have used a temproryTokenizer.From this temproryTokeniser i have eliminated the tokens with values" " and null Then i have made the finalToknizer
Joined: Aug 14, 2001
HI Thanks for the reply. The problem I have is that I need to retrieve token when the value is ,, . The StringTokenizer just skips this. I'll try to modify my example: I have data pertaining to a user for the fields below: fName, lname, userId, address1, address2,city, phone The corresponding values for the above fields are Sreeni, san, 12345, , #44 XYZ street,,234567 Now I tokenize the entire String and assign values to respective variables. While doing so I have encountered problems like for example: The value for fName, lname, userId, address1, address2 are returned correctly as tokens. The problem here is with city as the value ",," is skipped and 234567 is returned as next token immediately after address2. In case of address1 ", ," is value is returned as blank, which is fine for me. Kindly suggest me a suitable solution.