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

String operation - urgent

Former Member
0 Likes
522

Hello all,

I have a string like

<b>It is followed on monthly basis. | Ag and Ba not analysed | because they do not appear in the normal process</b>.

Now I have to parse this string and look for the special symbol '|'. The symbol '|' means a new line. So in the above string case whenever I come across '|', I have to take the string left to it into a separate string. So in this case I should split the above string as


String1 = It is followed on monthly basis.
String2 =  Ag and Ba not analysed 
String3 =  because they do not appear in the normal process

Experts please help me in this case. Waiting..........

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
499

Hi,

Check the internal table in the debugging mode..It is working fine..

IN the report I didn't give to display blank lines..That is the reason why it is not showing..

DATA: T_DATA TYPE STANDARD TABLE OF STRING WITH HEADER LINE.

DATA: V_STRING TYPE STRING.

V_STRING = 'ABC||DEF|'.

SET BLANK LINES ON.

SPLIT V_STRING AT '|' INTO TABLE T_DATA.

LOOP AT T_DATA.

WRITE: / T_DATA.

ENDLOOP.

Thanks,

Naren

4 REPLIES 4
Read only

Former Member
0 Likes
499

Hi,

Try this..

DATA: T_DATA TYPE STANDARD TABLE OF STRING WITH HEADER LINE.

DATA: V_STRING TYPE STRING.

V_STRING = 'ABC|DEF|'.

SPLIT V_STRING AT '|' INTO TABLE T_DATA.

LOOP AT T_DATA.

WRITE: / T_DATA.

ENDLOOP.

Thanks,

Naren

Read only

0 Likes
499

HI Naren,

THanks for the reply. I got only one final issue in this.

I may have consecutive '|' symbols. In which case, the output should come as follows


DATA: T_DATA TYPE STANDARD TABLE OF STRING WITH HEADER LINE.

DATA: V_STRING TYPE STRING.

V_STRING = 'ABC<b>||</b>DEF|'.

SPLIT V_STRING AT '|' INTO TABLE T_DATA.

LOOP AT T_DATA.
WRITE: / T_DATA.
ENDLOOP.

The output should be like;


ABC

DEF

Right now with your code I am getting like


ABC
DEF

Please help

Read only

Former Member
0 Likes
500

Hi,

Check the internal table in the debugging mode..It is working fine..

IN the report I didn't give to display blank lines..That is the reason why it is not showing..

DATA: T_DATA TYPE STANDARD TABLE OF STRING WITH HEADER LINE.

DATA: V_STRING TYPE STRING.

V_STRING = 'ABC||DEF|'.

SET BLANK LINES ON.

SPLIT V_STRING AT '|' INTO TABLE T_DATA.

LOOP AT T_DATA.

WRITE: / T_DATA.

ENDLOOP.

Thanks,

Naren

Read only

0 Likes
499

You are the MAN!! Thanks.