2006 Dec 12 12:32 PM
Hi, How could I find the % character in a string? I need its position in the string. The string is a field of a table.
Hi, How could I find the % character in a string? I need its position in the string. The string is a field of a table.
2006 Dec 12 12:38 PM
you can use the CP syntax.
if str cp '%'.
sy-fdpos would have the first occurance of %.
endif.
you can also use
search str for '%'. "newer versions of sap
sy-fdpos would have the first occurance of %.
find '%' in str. "newer versions of sap
Regards,
Ravi
2006 Dec 12 12:40 PM
Hi Jacob,
here a short example with char and string.
DATA: ST TYPE STRING.
DATA: CH(250).
*
************************************************************************
*
START-OF-SELECTION.
*
ST = 'I am a String with an % Character'.
*
SEARCH ST FOR '%'.
*
WRITE: / SY-SUBRC, sy-fdpos.
*
CH = 'I am a Char with an % Character'.
*
SEARCH CH FOR '%'.
*
WRITE: / SY-SUBRC, sy-fdpos.
*
Regards, Dieter
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |