Carey Brown wrote:There are java libraries which will parse csv, I've not used one myself, but they may be able to handle this situation.
Carey Brown wrote:You could write java that would do it but it would also be brittle in that a change to your data would probably change how certain lines are split. I don't know if it is possible but a better tactic would be to tackle the split where it is occurring. What program are you using to generate the csv and what program are you using to display the csv?
Carey Brown wrote:There are java libraries which will parse csv, I've not used one myself, but they may be able to handle this situation.
Carey Brown wrote:If java is creating the csv can you modify it to not replace the comma with a new line?
Paul Clapham wrote:The code is easy enough to write. Read the file one character at a time and use a flag to tell whether you're inside a quote. Then for each character: if it's not quote or end-line, write it to the output. If it's end-line, write end-line or space depending on whether you're inside a quote. If it's quote, write it and flip the flag.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Paul Clapham wrote:The code is easy enough to write. Read the file one character at a time and use a flag to tell whether you're inside a quote. Then for each character: if it's not quote or end-line, write it to the output. If it's end-line, write end-line or space depending on whether you're inside a quote. If it's quote, write it and flip the flag.
Phillip Powell wrote:It's not a course but a company requirement
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Our first order of business must be this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|