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

syntax help

Former Member
0 Likes
936

Hi All.

I have a string like

pavan,kumar and i want this displayed like

pavan , kumar how to achieve this.

I want space after pavan and space after ,.

Regrads

Pavan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
895
REPLACE ALL OCCURRENCES OF ',' IN v_str WITH ` , `.
8 REPLIES 8
Read only

Former Member
0 Likes
896
REPLACE ALL OCCURRENCES OF ',' IN v_str WITH ` , `.
Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
895

HI WENCELAUS,

Whats the difference between normal single quote ' ' and

` `.

I tried ur solution with normal quote it is not giving correct output.

but when tried with ` ` output is correct...

can u elaborate it??

cheers,

simha.

Read only

0 Likes
895

Hi Narasimha,

When you use single quotes, the SPACE character is not preserved.

But when you use `, the SPACE character is preserved.

Regards,

Wenceslaus.

Read only

Former Member
0 Likes
895

data : m(50) type c,

n(50) type c.

data : myspace(50) type c.

data : number type i.

number = 2.

concatenate 'pawan' ',' into m separated by myspace(number).

concatenate m 'kumar' into n separated by myspace(number).

Read only

Former Member
0 Likes
895

Hi Kumar,

Use <b>REPLACE</b> statement.

DATA V_STRING TYPE STRING VALUE 'PAVAN,KUMAR'.

<b>REPLACE ',' WITH ' , ' INTO V_STRING.</b>

<b>WRITE:/ V_STRING.</b>

Now V_STRING will have value 'PAVAN , KUMAR'.

REPLACE will do one occurence replacement.If you need to have replacement for all occurences use the following syntax.

<b>REPLACE ALL OCCURRENCES OF ',' IN V_STRING

WITH ' , '.

WRITE V_STRING.</b>

Thanks,

Vinay

Message was edited by: Vinaykumar Gorrela

Read only

0 Likes
895

Hi pavan

Check the following Code.

DATA: lv_str(30) VALUE 'pavan,kumar',

lv_str1(3) VALUE ' , '.

REPLACE ',' WITH lv_str1 INTO lv_str.

WRITE lv_str.

Read only

Former Member
0 Likes
895

copy paste and try this

REPLACE ALL OCCURReNCES OF ',' IN v_STRING WITH ` , ` .

use the quote symbols key as the key above tab key

Message was edited by: Chandrasekhar Jagarlamudi

Read only

Former Member
0 Likes
895

Hi,

check this...


REPORT  ZTEST                               .

data: text(50),delimit(20).

text = 'pavan,kumar'.

concatenate ` ` ',' `  ` into delimit separated by space.

REPLACE ALL OCCURRENCES OF ',' IN text WITH delimit.

write text.

Regards

vijay