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: 

How to replace required char with space in the string

Former Member
0 Kudos

I am using following way to replace all commas in the fieldname with space, but it is not working correctly.

fieldname = 'a,b,c'.

REPLACE ALL OCCURRENCES OF ',' IN fieldname WITH space.

fieldname becomes 'abc' after using above way.

anyone can suggest how to do it, thanks.

3 REPLIES 3

Former Member
0 Kudos

Check this

data:
  fieldname(20) type c.

fieldname = 'a,b,c'.
TRANSLATE fieldname USING ', '.

write: fieldname.

varma_narayana
Active Contributor
0 Kudos

Hi Yong..

Try using this statement:

TRANSLATE fieldname USING ', '. "Comma and SPACE

It will search for all the Occurrences of ',' and Replace it with the SPACE.

<b>Reward if helpful.</b>

Former Member
0 Kudos

Thanks guys, it is working pretty well.