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

string formatting.

Former Member
0 Likes
569

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

Former Member
0 Likes
534

Hi,

Try this.

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

Regards,

Surinder

3 REPLIES 3
Read only

Former Member
0 Likes
535

Hi,

Try this.

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

Regards,

Surinder

Read only

Former Member
0 Likes
534

Try with condense str with space

Read only

Former Member
0 Likes
534

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