‎2008 Jan 24 1:59 AM
I would like to replace all ',' appear in a strng by space. So, i use
replace all occurrences of ',' in tempStr with space.
But, the outcome is all pattern are replaced, and concatenate together. For example, i have string
tempStr = '1,2,3,4,5,6,7'
But the result is
tempStr = 1234567
How can i replace the string by space. thanks!
‎2008 Jan 24 2:22 AM
Hi,
Try the below logic:
data: val1 type char10.
val1 = '1,2,3,4,5'.
write : / val1.
do.
replace ',' with ' ' into val1.
if sy-subrc <> 0.
exit.
endif.
enddo.
write : / val1.
‎2008 Jan 24 3:20 AM
data: tempStr type string value '1,2,3,4,5,6,7'.
REPLACE ALL OCCURRENCES OF REGEX ',' IN tempstr WITH ''.
write:/ tempstr.
‎2008 Jan 24 4:14 AM
Hi,
Try this.
data : tempstr type string,
temp(2) type c.
tempStr = '1,2,3,4,5,6,7'
temp = ', '.
Translate tempstr using temp.
Write tempstr.
Regards,
Mohaiyuddin