Skip to Content
avatar image
Former Member

string formatting.

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 29, 2008 at 07:36 AM

    Hi,

    Try this.

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

    Regards,

    Surinder

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 29, 2008 at 07:39 AM

    Try with condense str with space

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 29, 2008 at 07:58 AM

    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
    

    Add comment
    10|10000 characters needed characters exceeded