Application Development 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: 

Reverse a string....

Former Member
0 Kudos
133

Hai....

Can any one say me what is the string operation that i have to use to reverse the contents of a string...say the string is 'ABCDE'...i want it as 'EDCBA'.

Will be rewarded if helpfull.....

Regards,

Jhansi..

1 ACCEPTED SOLUTION

Former Member
0 Kudos
93

Hai Janu

Run this Program.

data : c(5) value 'ABCDE'.

data : l type i,i type i value -1.

data : str(5) .

l = strlen( c ).

do l times.

i = i + 1.

l = l - 1.

STRi(1) = Cl(1).

enddo.

write STR.

6 REPLIES 6

Former Member
0 Kudos
93

Sorry, My fault

After all there is a function - STRING_REVERSE

Regards,

Ravi

Message was edited by:

Ravikumar Allampallam

raja_thangamani
Active Contributor
0 Kudos
93

Use function module STRING_REVERSE.

Raja T

0 Kudos
93

Hi,

Use the function module STRING_REVERSE.

Regards,

Sesh

Former Member
0 Kudos
93

Hi Jhansi kiran,

Use FM "STRING_REVERSE" . By using the "SHIFT" also you can achieve,but lengthy way.

Pls. reward for useful answers

Former Member
0 Kudos
93

try this code

data : strlength type i,

main(5) type c value 'abcde',

rev(5),

counter type i,

temp type i.

compute strlength = strlen( main ).

temp = strlength.

do strlength times.

temp = temp - 1.

revcounter(1) = maintemp(1).

counter = counter + 1.

enddo.

regards

shiba dutta

Former Member
0 Kudos
94

Hai Janu

Run this Program.

data : c(5) value 'ABCDE'.

data : l type i,i type i value -1.

data : str(5) .

l = strlen( c ).

do l times.

i = i + 1.

l = l - 1.

STRi(1) = Cl(1).

enddo.

write STR.