‎2008 May 16 5:21 AM
HI all,
please tell me how to reverse a string like abc = cba
thanks
‎2008 May 16 5:25 AM
‎2008 May 16 5:28 AM
HI,
use the function module STRING_REVERSE
DATA:str(10) value 'ABC',
r_str(10).
CALL FUNCTION 'STRING_REVERSE'
EXPORTING
STRING = str
LANG = 'E'
IMPORTING
RSTRING = r_str.
WRITE:/ r_str.
rgds,
bharat.
‎2008 May 16 5:29 AM
Check the below code...
data : l_str(15) type c.
data : l_len type i.
data : l_revstr(15).
l_len = strlen( l_str ).
do.
l_len = l_len - 1.
concatenate l_revstr l_str+l_len(1) into l_revstr.
if l_len = 0.
exit.
endif.
enddo.
write : / l_str,
/ l_REvstr.Hope this is helpful.
THanks,
Pavan
‎2008 May 16 5:32 AM