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

Is there a function module which swaps a string?

Former Member
0 Likes
440

Hi ABAP,

i got a string. Example: 'hello world, blablabla fhuhfuahu psiuiua auugui'.

what i really want is to search the string for the first space, but from the right side.

in the search statement i have not found any addition which allows me to search the string backwards. Maybe if i give starting_at a higher value than ending_at. tho i dont believe that.

so i though about a workaround.

I´d like to swap the string so first character becomes last character and last becomes first. now i could search the swapped string for the first occurance of space.

if anyone got any ideas regarding this scenario i´d really like to hear them.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
354

Hi,

Use the function module STRING_REVERSE to reverse a string then use the Search for the SPACE in the reversed string then do the code which suits your requirment

Regards

Sudheer

1 REPLY 1
Read only

Former Member
0 Likes
355

Hi,

Use the function module STRING_REVERSE to reverse a string then use the Search for the SPACE in the reversed string then do the code which suits your requirment

Regards

Sudheer