- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 09-14-2010 08:34 AM
(21056 views)
Hi,
I thought that this would be a fairly basic problem but I'm struggling for an answer.
I'm trying to remove single and double quote marks from a character variable.
The two statements I'm using to try do this are COMPRESS and TRANWRD. Both of these however, require you to put the character you want to remove inside quotation marks e.g.
COMPRESS(character-variable,''') ;
TRANWRD(character-variable,''','') ;
This obvously causes problems as the quotation mark I want to remove closes the second part of each statement.
Is there any way to get around this or another way of doing it?
Cheers,
Fat Captain.
I thought that this would be a fairly basic problem but I'm struggling for an answer.
I'm trying to remove single and double quote marks from a character variable.
The two statements I'm using to try do this are COMPRESS and TRANWRD. Both of these however, require you to put the character you want to remove inside quotation marks e.g.
COMPRESS(character-variable,''') ;
TRANWRD(character-variable,''','') ;
This obvously causes problems as the quotation mark I want to remove closes the second part of each statement.
Is there any way to get around this or another way of doing it?
Cheers,
Fat Captain.
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Inside use two. See example.
[pre]
"""'"
or
'''"'
[/pre]
[pre]
"""'"
or
'''"'
[/pre]
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Cheers,
Thanks for this.
Thanks for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Another solution is the DEQUOTE function. Call dequote(variable) if the first character is a single or double quote character. It will also remove any text after the closing/right quote(s). [ref]
I know this is an older post, but it was one of the first results when searching this, so I figured including this solution here would be a good idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I ended up using word = compress(word,"""'");
as it said the call dequote function could not be found, and similairly if I use word = dequote(word); then it removed leading quotes, but not closing quotes.
as it said the call dequote function could not be found, and similairly if I use word = dequote(word); then it removed leading quotes, but not closing quotes.