You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Emmanuel Bourg (Commented) (JIRA)" <ji...@apache.org> on 2011/11/12 01:48:53 UTC
[jira] [Commented] (SANDBOX-242) Encapsulated csv line strategy
[ https://issues.apache.org/jira/browse/SANDBOX-242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148909#comment-13148909 ]
Emmanuel Bourg commented on SANDBOX-242:
----------------------------------------
You simply have to run it twice through Commons CSV, the result will be:
{code}[, AD, ALV, Andorra la Vella, Andorra la Vella, , --34-6--, AI, 0601, , 4230N 00131E, ]{code}
Here is the code I used:
{code}String string1 = ...
CSVFormat format = CSVFormat.DEFAULT;
String string2 = new CSVParser(new StringReader(string1), format).getLine()[0];
String[] result = new CSVParser(new StringReader(string2), format).getLine();
{code}
> Encapsulated csv line strategy
> ------------------------------
>
> Key: SANDBOX-242
> URL: https://issues.apache.org/jira/browse/SANDBOX-242
> Project: Commons Sandbox
> Issue Type: Improvement
> Components: CSV
> Reporter: marc schipperheyn
> Priority: Minor
> Fix For: CSV 1.x
>
>
> I ran into this csv file :
> {code}
> ",""AD"",""ALV"",""Andorra la Vella"",""Andorra la Vella"",,""--34-6--"",""AI"",""0601"",,""4230N 00131E"","""""
> {code}
> It basically and weirdly encapsulates an entire line in " as a sort of record identifier and has double "" to identify values
> I'm having difficulty finding a tool that can parse this easily.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira