2010 Mar 15 3:20 PM
Dear SAP Gurus
I have a question regarding handling a string data.
Say I have a string ABCD'\&%$!!ABC'AAA123. Please notice that there are single quotes in my string.
I am writing a parser code in ABAP and getting into problem with if statement to check if the character read is a single quote.
When I type the following with a singleQuote between 2 singleQuoes as below, it gives error.
If CHAR = '''.
ENDIF.
How do I handle that? I searched for escape sequence and couldn't get any useful info.
Any feedback will be highly appreciated.
Thanks
Ram
2010 Mar 15 3:27 PM
Two single quotes represent one single quote for such purposes, means that you need four in a row in your example.
Thomas
2010 Mar 15 3:27 PM
Two single quotes represent one single quote for such purposes, means that you need four in a row in your example.
Thomas
2010 Mar 15 4:16 PM
Thanks for all the help. I appreciate it a lot. Used the first suggestion of having 4 quotes and it worked. Good to know other alternatives also. Thanks.
2010 Mar 15 3:45 PM
Before parsing, you can REPLACE ALL OCCURRENCES OF '''' IN your_variable WITH some other character or group of characters that you don't expect to find. Then parse based on the new character(s).
Rob
2010 Mar 15 3:47 PM
Or just use string literals
if char = `'`. "note that ` is the "backquotation" mark not a regular quotation mark '
Regards
Marcin
2024 Feb 20 4:55 AM
I am getting the same issue for below i18nn text: