Splitting comma delimited text

S

Søren M. Olesen

Hi

I need to split a comma delimited text, however if the comma is between ' '
then no split should occur

ie:

Class.Value, 'true' , 'some text', 'false', 'text, text, text'

should split into:

Class.Value
'true'
'some text'
'false'
'text, text, text'

Class.Value, 'true' , 'some text', Class.Name, '1a2, 3c4, k'

should split into:

Class.Value
'true'
'some text'
Class.Name
'1a2, 3c4, k'

and so on, what split expression should I use for that??

TIA

Søren
 
G

Gunnar Hjalmarsson

Søren M. Olesen said:
I need to split a comma delimited text, however if the comma is between ' '
then no split should occur

perldoc -q "except when inside"
 
D

DJ Stunks

Søren M. Olesen said:
Hi

I need to split a comma delimited text, however if the comma is between ''
then no split should occur

"Parsing CSV files is nasty. It seems so simple, but it
usually isn't. Thankfully Text::CSV_XS takes care of
most of that nastiness for [you]"
-- Text::CSV::Simple Description

-jp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top