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

Splitting a string

Former Member
0 Likes
577

Hi all,

I have a string as follows:

DATA: d(20) TYPE c,

d1 type string.

d = 'xy10007101'.

I want to get xy, 1000 and 7101 as seperate strings.Tried as follows but gives an error.

d1 = d - d(2).

How to get them seperately.

Also If i have declared 'xy10007101' as a string and If I wanted to use the "split" function ,how can I put a delimiter say ',' into the string and then later call the split function....

Thanks

P

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
544

Hi ,

this is very simple...instead of using the '-' sign use the '+' sign like

DATA: d(20) TYPE c,

d1 type string.

d = 'xy10007101'.

I want to get xy, 1000 and 7101 as seperate strings.Tried as follows but gives an error.

d1 = d - d(2).

d1 = d+0(2).

d2 = d+2(4).

d3 = d+6(4),

all the d1,d2,d3 are c type with the desired legth.

For Split.....press f1 you'll get the result...else use SPLIT d at ',' into d1 d2 d3 d4 .

Hope this will solve you problem.

Pooja

Edited by: Pooja Gupta on Feb 7, 2010 2:13 PM

4 REPLIES 4
Read only

vinod_vemuru2
Active Contributor
0 Likes
544

Hi,

Click F1 on the word SPLIT. You will get the answer with many more examples.

Thanks,

Vinod.

Read only

Former Member
0 Likes
545

Hi ,

this is very simple...instead of using the '-' sign use the '+' sign like

DATA: d(20) TYPE c,

d1 type string.

d = 'xy10007101'.

I want to get xy, 1000 and 7101 as seperate strings.Tried as follows but gives an error.

d1 = d - d(2).

d1 = d+0(2).

d2 = d+2(4).

d3 = d+6(4),

all the d1,d2,d3 are c type with the desired legth.

For Split.....press f1 you'll get the result...else use SPLIT d at ',' into d1 d2 d3 d4 .

Hope this will solve you problem.

Pooja

Edited by: Pooja Gupta on Feb 7, 2010 2:13 PM

Read only

0 Likes
544

Thanks pooja,1 more question

>>else use SPLIT d at ',' into d1 d2 d3 d4 .

But in my string I dont have the "," delimiter.So I have to put this delmiter to my string right?

How will I put it?

Read only

0 Likes
544

Got it

used "REPLACE" to put the delimiter.

Thanx