|
Something else you might want to consider is if you have a comma within the
text as well.
Example:
1,"Test,Tested"
Or even:
1, "Test,""Tested""
This is one of the main reasons I haven't written a custom parser for
something like this. I have done it in Java, but you generally have to read
the string character by character and then test the next character for any
delimiters, but also make sure it's not just a blank string field.
It's obviously possible or there would not be any tools to do it, but it's
does not seem like an easy task.
Hope this helps,
James R. Perkins
On Fri, Oct 17, 2008 at 11:31 AM, Charles Wilt <charles.wilt@xxxxxxxxx>wrote:
The code should be:
When you hit ," to start a quote string, don't look for another ,
Instead look for the ending "
Of course what happens when you have a " in the data, whatever
exported it should have escaped it in some manner. Usually by
doubling the "
Charles
On Fri, Oct 17, 2008 at 2:13 PM, Jeff Young <cooljeff913@xxxxxxxxx>
wrote:
Does anyone have an example of how to extract a quoted string containinga comma in a CSV file?
I have adapted the PipeDelim program from Scott Kelment, and it worksgreat until I hit this condition.
I do not have the luxury of changing the format of the input file as itis being provided by a 3rd party.
Solutions V5R2
Thanks in advance,
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical
IBM Certified Specialist- e(logo) server i5Series Technical SolutionsDesigner V5R3
IBM Certified Specialist- e(logo)server i5Series Technical SolutionsImplementer V5R3
--list
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
To post a message email: RPG400-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.