Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

String reversal

Former Member
0 Likes
731

The code for reversing a string

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
708

hi,

************

parameters:

p_char(20).

data:

w_length type i,

w_count1 type i,

w_revchar(20) type c.

w_revchar = p_char.

w_length = STRLEN( w_revchar ).

w_count1 = w_length.

do w_length times.

shift w_revchar+0(w_count1) by 1 places circular.

subtract 1 from w_count1.

enddo.

write: w_revchar.

****************

regards,

naresh.

6 REPLIES 6
Read only

suresh_datti
Active Contributor
0 Likes
708

Use the function module STRING_REVERSE.

~Suresh

Read only

Former Member
0 Likes
708

Use FM <b>STRING_REVERSE</b>

Regards,

Santosh

Read only

Former Member
0 Likes
708

Hi,

Please check the link,

Regards,

Hema.

    • Reward points if it is useful.

Read only

alex_m
Active Contributor
0 Likes
708

Fm STRING_REVERSE .

Read only

Former Member
0 Likes
708

this is how you can use this FM

call function 'STRING_REVERSE'
 exporting
   string = L_NAME
    lang = 'E'
 IMPORTING
   RSTRING = R_STRING.

regards,

Santosh

Read only

Former Member
0 Likes
709

hi,

************

parameters:

p_char(20).

data:

w_length type i,

w_count1 type i,

w_revchar(20) type c.

w_revchar = p_char.

w_length = STRLEN( w_revchar ).

w_count1 = w_length.

do w_length times.

shift w_revchar+0(w_count1) by 1 places circular.

subtract 1 from w_count1.

enddo.

write: w_revchar.

****************

regards,

naresh.