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 : REPLACE OPERATION

Former Member
0 Likes
1,459

Hi ,

for the code :

data : string(4) type c.

string = 'ASDF'.

NOW I WANT TO REPLACE D IN STRING WITH SPACE ie ' '.

but when i use

Replace d in string with ' '.

then the output is 'ASF' ..NO SPACE IS BEING INSERTED.

CAN NYONE HELP ME HOW TO REPLACE D WITH SPACE....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,411

Try this:

Replace d in string with ` `.

<b>NOte that the quotes are not ' but `(The key above the tab key in the keyboard.</b>

REgards,

Ravi

12 REPLIES 12
Read only

Former Member
0 Likes
1,411

Hi

Split str at 'd' into str1 str2.

concatenate str1 str2 into str seperated by space.

Read only

Former Member
0 Likes
1,411

split string at 'D' into str1 str2.

concatenate str1 str2 separated by space.

Read only

Former Member
0 Likes
1,411

Try 'translate' instead of 'replace'..

translate s using 'D '.

Read only

0 Likes
1,411

Use <b>Translate</b> Statement or do this way

Data : v_string type string,

STR1,STR2,STR3 TYPE STRING.

v_string = 'ASDF'.

SPLIT V_STRING AT 'D' INTO STR1 STR2.

CONCATENATE STR1 STR2 INTO STR3 SEPARATED BY SPACE.

WRITE STR3.

Read only

rahulkavuri
Active Contributor
0 Likes
1,411

declare STR2.

REPLACE all occurances of 'D' WITH space INTO STR2.

Read only

Former Member
0 Likes
1,411

hi rajesh,

replace 'D' in string with space.

Award if it helps.

regards,

keerthi.

Read only

Former Member
0 Likes
1,411

Hi Rajesh

REPLACE <str1> WITH <str2> INTO <c> [LENGTH <l>].

Replace D with ' ' into str1.

Regards

Laxmi

Read only

Former Member
0 Likes
1,411

HI RAJESH,

data: p type string value 'asdf'.

<b>Replace 'd' with ' ' into p.</b>

write:/ p.

hope this helps,

priya

Read only

0 Likes
1,411

REPORT ZNEGIDEMO .

DATA: A(4) TYPE C,

A1(20) VALUE 'ABCDE'.

REPLACE ALL OCCURRENCES OF 'D' IN a1 with space.

write a1.

AND ALSO SEE THIS LINK UR ALL POINTS ARE CLEAR....

Message was edited by: kishan negi

Read only

Former Member
0 Likes
1,412

Try this:

Replace d in string with ` `.

<b>NOte that the quotes are not ' but `(The key above the tab key in the keyboard.</b>

REgards,

Ravi

Read only

Former Member
0 Likes
1,411

THANX RAVI IT WORKED THAX A LOT

Read only

0 Likes
1,411

hi rajesh,

did u check my reply that also works.

try checking that.

thanks,

priya.