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

working with single quotes

Former Member
0 Likes
1,222

Hi all,

I want to check whether a variable has a single quote or double quote. If it has I have to remove them.

"Don't".

In this case it has both single and double quote. I want to change this to

Dont

If there is any escape character for ' (single quote) please let me know.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,184

The escape character for Single Quote...Is another Single Quote -:)

<b>''This is single quoted''</b>.

Greetings,

Blag.

Or........... in new releases, you can use the backwards quote as the wrapper. The syntax checker can then see the single quote (').

data: str type string.

str = `"Don't"`.
translate str using `" `.
TRANSLATE str using `' `.
CONDENSE str NO-GAPS.
write:/ str.

Regards,

RIch Heilman

7 REPLIES 7
Read only

Former Member
0 Likes
1,185

The escape character for Single Quote...Is another Single Quote -:)

<b>''This is single quoted''</b>.

Greetings,

Blag.

Read only

0 Likes
1,184

Or........... in new releases, you can use the backwards quote as the wrapper. The syntax checker can then see the single quote (').

data: str type string.

str = `"Don't"`.
translate str using `" `.
TRANSLATE str using `' `.
CONDENSE str NO-GAPS.
write:/ str.

Regards,

RIch Heilman

Read only

0 Likes
1,184

Hi Rich,

That is cool. Which release does this apply to?

Cheers

Gareth

Read only

0 Likes
1,184

I know that it works in Netweaver 2004s, I think it may work in NW2004 as well. I know for a fact that this does not work in 46c.

Yeah, it is cool. I have been so used to using multiple quotes to represent single quotes, and it does get confusing, so this syntax is really helpful.

Regards,

Rich Heilman

Read only

0 Likes
1,184

Many Thanks for the tip Rich.

It works for me on 4.7

Regards

Eswar

Read only

0 Likes
1,184

Thanks Rich. It works great.

Read only

Former Member
0 Likes
1,184

Hi,

This is how you do it.

constants: c_comma type c value ''''.

So in you case you would add the above to your data declarations and then search your field for c_comma and use replace c_comma with '' into <field>.

Regards

Gareth