cancel
Showing results for 
Search instead for 
Did you mean: 

Trim Space from a string

Former Member
0 Kudos

Hello All,

I need to trim space from beginning and end of a string.

For example -

astring = ' hello123 '.

I need to get astring as 'hello123'.

Thanks in advance.

Viren

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Try,

SHIFT ASTRING RIGHT DELETING TRAILING SPACE.

Hope this helps!!

Gabriel

Answers (3)

Answers (3)

Former Member
0 Kudos

HI,

DATA: ASTRING(50) type c.

p_field = 'Welcome to SAPDev'.

CONDENSE ASTRING NO-GAPS. "ASTRING must be of type character

<i>*Result of p_field would be: 'WelcometoSAPDev'</i>.

Thanks

Sudheer

Former Member
0 Kudos

Thanks guys! It works

ferry_lianto
Active Contributor
0 Kudos

Hi Viren,

You can code like this

WRITE ASTRING TO ASTRING NO-GAP.

Hope this will help.

Regards,

Ferry Lianto

Former Member
0 Kudos

If you don't want any spaces, then all you have to do is

CONDENSE astring NO-GAPS.