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

escape character

Former Member
0 Likes
1,166

Hello,

I need to build a function that replace the character "," by the string " ',' "

Example: Char1: 1,2,3

Char1 after conversion: 1','2','3

I m using the code:

DATA text TYPE string VALUE '1,2,3,4'.

REPLACE ALL OCCURRENCES OF REGEX ',' IN text WITH __?____.

I don´t know how to use the "escape character" so as to I can use the charater " ' " after of with.

Can someone help me ??

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,115

Hi,

REPLACE all occurances of space IN your_string WITH 'Your_character' INTO lv_date

example code

data: string(10) type c,

string = '1212121212'.

translate string using '20'.

So in this case the value will now be '1010101010'

*Reward points

Regards

Hi,

REPLACE all occurances of space IN your_string WITH 'Your_character' INTO lv_date

example code

data: string(10) type c,

string = '1212121212'.

translate string using '20'.

So in this case the value will now be '1010101010'

*Reward points

Regards

7 REPLIES 7
Read only

Former Member
0 Likes
1,116

Hi,

REPLACE all occurances of space IN your_string WITH 'Your_character' INTO lv_date

example code

data: string(10) type c,

string = '1212121212'.

translate string using '20'.

So in this case the value will now be '1010101010'

*Reward points

Regards

Read only

0 Likes
1,115

But I need to replace "," by " ',' " (3 characters) ...

I don´t understand how to do....

Read only

0 Likes
1,115

data: replacetext type string .

replacetext = `','`  .
replace all occurrences of ',' in  <sourcevar> with replacetext .

please pay attendtion to

`','`

the sorround quote is actually the key (in your keyboard) to the left of number 1 .

Message was edited by:

Durairaj Athavan Raja

Read only

Former Member
0 Likes
1,115

hi,

try like this

REPLACE ALL OCCURRENCES OF ',' WITH ' '" ,"'.

if helpful reward some points.

with regards,

suresh.

Read only

0 Likes
1,115

It happens the next syntax error:

"." expected after '" ,"'.

Thanks.

Read only

santhosh_patil
Contributor
0 Likes
1,115

Hi,

check this out

data: char(10) type c,

char1(10) type c.

data: len TYPE I.

char = 'a,b'.

replace ',' with <b>''','''</b> into char.

write char.

--Patil

Read only

Former Member
0 Likes
1,115

Hi,

try like this

data : string(10) type c.

string = 'boy_&_girl'.

translate string using '_ '.

Write:/ string.

<b>*Reward points</b>

Regards