Skip to Content
avatar image
Former Member

remove character from a string

wats the command to remove characters in a string?

I have to remove 'bb' from a string

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Sep 03, 2008 at 09:43 AM

    hi,

    you can try the REPLACE statement. There will be a space in the string instead of 'bb', which you can delete with CONDENSE ... NO-GAPS.

    hope this helps

    ec

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 09:49 AM

    Hello

    DATA FIELD(10).
    MOVE 'ABCBB' TO FIELD.
    REPLACE 'BB' WITH ' ' INTO field.
    CONDENSE field.
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 10:05 AM

    Hi

    DATA lv_field(5).
    MOVE 'CCCBB' TO lv_field.
    SEARCH lv_field FOR 'BB'.
    IF sy-subrc = 0.
      REPLACE 'BB' WITH ' ' INTO lv_field.
      CONDENSE lv_field.
      WRITE lv_field.
    ENDIF.
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 10:20 AM

    Please do not double-post or cross-post your questions.

    We typically delete all the questions when this is found.

    Cheers,

    Julius

    Add comment
    10|10000 characters needed characters exceeded