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: 

string formatting.

Former Member
0 Kudos

Hi all.

I want to format string.

The string is like..S = 'UPS Surface Collect #954365'.

Inthis string after 'Collect' there age two spaces which I want only one.

How to do this.

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try this.

REPLACE ALL OCCURRENCES OF ' #' IN str WITH '#'.

Regards,

Surinder

3 REPLIES 3

Former Member
0 Kudos

Hi,

Try this.

REPLACE ALL OCCURRENCES OF ' #' IN str WITH '#'.

Regards,

Surinder

Former Member
0 Kudos

Try with condense str with space

former_member212653
Active Contributor
0 Kudos

Try this:


DATA: l_string TYPE string,
      l_final TYPE string.

l_string =  'UPS Surface Collect #954365'.

DATA: l_dummy1 TYPE string,
      l_dummy2 TYPE string.


SPLIT l_string AT ' #' INTO l_dummy1 l_dummy2.

CONCATENATE l_dummy1 l_dummy2 INTO l_final.

WRITE:/1 l_final.

Output:


UPS Surface Collect954365