Skip to Content
avatar image
Former Member

STRING : REPLACE OPERATION

Hi ,

for the code :

data : string(4) type c.

string = 'ASDF'.

NOW I WANT TO REPLACE D IN STRING WITH SPACE ie ' '.

but when i use

Replace d in string with ' '.

then the output is 'ASF' ..NO SPACE IS BEING INSERTED.

CAN NYONE HELP ME HOW TO REPLACE D WITH SPACE....

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

9 Answers

  • Best Answer
    May 25, 2006 at 11:32 AM

    Try this:

    Replace d in string with ` `.

    <b>NOte that the quotes are not ' but `(The key above the tab key in the keyboard.</b>

    REgards,

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 25, 2006 at 11:07 AM

    Hi

    Split str at 'd' into str1 str2.

    concatenate str1 str2 into str seperated by space.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 25, 2006 at 11:07 AM

    split string at 'D' into str1 str2.

    concatenate str1 str2 separated by space.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 25, 2006 at 11:07 AM

    Try 'translate' instead of 'replace'..

    translate s using 'D '.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Use <b>Translate</b> Statement or do this way

      Data : v_string type string,

      STR1,STR2,STR3 TYPE STRING.

      v_string = 'ASDF'.

      SPLIT V_STRING AT 'D' INTO STR1 STR2.

      CONCATENATE STR1 STR2 INTO STR3 SEPARATED BY SPACE.

      WRITE STR3.

  • avatar image
    Former Member
    May 25, 2006 at 11:10 AM

    declare STR2.

    REPLACE all occurances of 'D' WITH space INTO STR2.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 25, 2006 at 11:12 AM

    hi rajesh,

    replace 'D' in string with space.

    Award if it helps.

    regards,

    keerthi.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 25, 2006 at 11:17 AM

    Hi Rajesh

    REPLACE <str1> WITH <str2> INTO <c> [LENGTH <l>].

    Replace D with ' ' into str1.

    Regards

    Laxmi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 25, 2006 at 11:22 AM

    HI RAJESH,

    data: p type string value 'asdf'.

    <b>Replace 'd' with ' ' into p.</b>

    write:/ p.

    hope this helps,

    priya

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      REPORT ZNEGIDEMO .

      DATA: A(4) TYPE C,

      A1(20) VALUE 'ABCDE'.

      REPLACE ALL OCCURRENCES OF 'D' IN a1 with space.

      write a1.

      AND ALSO SEE THIS LINK UR ALL POINTS ARE CLEAR....

      syntax-error

      Message was edited by: kishan negi

  • avatar image
    Former Member
    May 25, 2006 at 12:01 PM

    THANX RAVI IT WORKED THAX A LOT

    Add comment
    10|10000 characters needed characters exceeded