Closed GoogleCodeExporter closed 9 years ago
Original comment by cpov...@google.com
on 18 Dec 2013 at 12:23
I don't think this is a duplicate of 813. #813 is specifically for CSV, whereas
this issue would not only be used for CSV processing, e.g.,
String value = "[a][b][c]["this[one]"][d]"
Splitter.on("[]").exceptWhenSurroundedBy('"').split(value)
result: [a], [b], [c], ["this[one]"], [d]
Also, this issue is _much_ smaller in scope than CSV support, which seems
unlikely to happen any time soon, so I'd hate to see this grouped together with
a 2-year old issue.
Original comment by tedyo...@gmail.com
on 18 Dec 2013 at 3:07
The CSV parser is indeed a larger undertaking, one that would cover text with
non-comma separators. I do think that that's the right thing here. We'd prefer
to give users a way to remove quotes automatically, and we'd prefer to give
them a way to escape any quotes that might appear in the string.
The other example you give will also need support beyond a simple
exceptWhenSurroundedBy:
String value = "[a][b][c][\"this[one]\"][d]";
Splitter.on(anyOf("[]")).split(value) =>
, a, , b, , c, , this[one], , d,
We could add in an omitEmptyStrings call, but then it becomes impossible to
express a "true" empty segment with "[]".
There are surely many users who need only one or two additions to Splitter. The
catch is that they're often different features. Whether our eventual CSV parser
is built atop Splitter or not, we'd like for it to cover as many cases as
possible, and we'd like for it to go the whole way where it can -- automated
quoting and so forth.
Original comment by cpov...@google.com
on 18 Dec 2013 at 4:57
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<issue id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:10
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:08
Original issue reported on code.google.com by
tedyo...@gmail.com
on 18 Dec 2013 at 12:20