‎2006 Oct 02 7:57 AM
ABAPers,
I need to loop over all the characters in a string. Here is the pseudo code:
data: myData TYPE string.
data: n TYPE i.
data: ch TYPE char1.
n = STRLEN( myData).
DO n TIMES.
ch = myData(sy-index).
...
ENDDO.
While this code would work, the problem is that I am actually iterating over myData two times. STRLEN itself is internally iterating over myData to compute the length.
Is there a more efficient looping mechanism without going through STRLEN?
Thank you in advance for your help.
Pradeep
‎2006 Oct 02 8:09 AM
Hi,
You can try this when it comes to converting things
WHILE myData IS NOT INITIAL.
do something
ENDIF.
myData = myData+1(*).
Eddy
PS.
Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
Spread the wor(l)d!
‎2006 Oct 02 8:09 AM
Hi,
You can try this when it comes to converting things
WHILE myData IS NOT INITIAL.
do something
ENDIF.
myData = myData+1(*).
Eddy
PS.
Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
Spread the wor(l)d!
‎2006 Oct 02 8:35 AM