Application Development 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: 

syntax help

Former Member
0 Kudos

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

Former Member
0 Kudos
REPLACE ALL OCCURRENCES OF ',' IN v_str WITH ` , `.
8 REPLIES 8

Former Member
0 Kudos
REPLACE ALL OCCURRENCES OF ',' IN v_str WITH ` , `.

0 Kudos

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.

0 Kudos

Hi Narasimha,

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

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

Regards,

Wenceslaus.

Former Member
0 Kudos

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).

Former Member
0 Kudos

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

0 Kudos

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.

Former Member
0 Kudos

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

former_member188685
Active Contributor
0 Kudos

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