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

Reverse a string....

Former Member
0 Likes
972

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
Read only

Former Member
0 Likes
932

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
Read only

Former Member
0 Likes
932

Sorry, My fault

After all there is a function - STRING_REVERSE

Regards,

Ravi

Message was edited by:

Ravikumar Allampallam

Read only

raja_thangamani
Active Contributor
0 Likes
932

Use function module STRING_REVERSE.

Raja T

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
932

Hi,

Use the function module STRING_REVERSE.

Regards,

Sesh

Read only

Former Member
0 Likes
932

Hi Jhansi kiran,

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

Pls. reward for useful answers

Read only

Former Member
0 Likes
932

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

Read only

Former Member
0 Likes
933

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.