Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

split string at comma, ignoring quotation marks

Former Member
0 Likes
1,477

I have got a string of format

a = 'b,c,"1,234.0",d,"56,789.54",g'

what i need is something similar to below

an internal table with each data as a line item

b

b

1234.0

d

56789.54

g

or  a string like

a = 'b,c,"1234.0",d,56789.54,g'  is good.so that i can split based on comma

Currently I cant split this based on comma .as it will split 1,234.0 into 1 and 234.0

so in general i want to delete comma which comes between "" in a string.and there can be multiple such "" in a single string

Please help ..

1 REPLY 1
Read only

former_member392866
Active Participant
0 Likes
621

Hi,

check below logic once.

data : a(30) type c.

data : b(8) type c,

        c(8) type c,

        d(8) type c,

        e(8) type c,

        f(8) type c,

        g(8) type c,

        h(8) type c.

data : x(10) type c,

        y(10) type c.

a = 'b,c,"1,234.0",d,"56,789.54",g' .

split a at '"' into b x c y d.

split x at ',' into e f.

split y at ',' into g h.

clear : x,y,a.

concatenate e f into x.

concatenate g h into y.

concatenate b x c y d into a.

clear : b,c,d,e,f,g,h.

split a at ',' into b c d e f g h.

write : / b, / c, / d,/ e,/ f,/ g,/ h.

out put:

               b

               b

               1234.0

               d

               56789.54

               g

Hope this code solved your problem.

Regards,

BALAJI.