Thursday, 19 September 2013

String.split a text

String.split a text

My program reads a line from a file. This line contains comma-seperated
text like:
123,test,444,"don't split, this",more test,1
I would like the result of a split to be this:
123
test
444
"don't split, this"
more test
1
If I use the String.split(","), I would get this:
123
test
444
"don't split
this"
more test
1
In other words: The comma in the substring "don't split, this" is not a
seperator. How to deal with this?
Thanks in advance.. Jakob

No comments:

Post a Comment