String Split CSV
807606Jun 4 2007 — edited Jun 9 2007Hi Guys,
Sry if this question is already answered, I looked around and didn't find it. I'm using string split to parse csv files. Here is my problem
Assume these are the lines:
a1,a2,a3,,,a4
b1,b2,b3,,,
c1,c2,c3,c4,c5,c6
Now when I read these lines from a CSV files and store them into an String array.
firstLine.length comesup 6
2nd coms 3 <-- the last three are being ignored
3rd comesup as 6
the output for 2nd line will be b1 b2 b3
I would also like to get the empty spaces at the end into the array so that 2nd line array .length will aslo comeup as 6 and the out but as b1 b2 b3 space space space.
Is this possible to do with the String split method?
I can't use split(String regex, int limit) as the number of columns will differ with each csv file.
Thanks in advance.