‎2006 Aug 21 8:32 PM
Hello all,
I would like to modify a sting in that way that the characters, defined by a specific syntax, should be cleared. E.g., the following syntax: <[C|CC]>, all elements which begin with the '<' character and ends with '>' character. The characters '<' and '>' enclose one or two characters.
E.g. I have the following string: 'Hermann Hesse was born <b><B></b>125<b></></b> years ago'.
After conversion the Syntax should contain: 'Hermann Hesse was born 125 years ago'.
I tried the classical way using <b>REPLACE ALL OCCURENCES</b>, but it didnt work.
Thank you for your hints.
Regards,
Kurt.
Message was edited by: Kurt Weiskopf
Message was edited by: Kurt Weiskopf
‎2006 Aug 21 8:56 PM
Hi Kurt. Please check the following sample program.
report zrich_0001.
data: string(100) type c.
data: start type i.
data: end type i.
data: len type i.
string = '<b>This</> is really <b>fun</>'.
do.
search string for '<'.
if sy-subrc <> 0.
exit.
endif.
start = sy-fdpos.
search string for '>'.
end = sy-fdpos.
len = ( end - start ) + 1.
string+start(len) = space.
condense string.
enddo.
write:/ string.
check sy-subrc = 0.
Regards,
RIch Heilman
‎2006 Aug 21 8:56 PM
Hi Kurt. Please check the following sample program.
report zrich_0001.
data: string(100) type c.
data: start type i.
data: end type i.
data: len type i.
string = '<b>This</> is really <b>fun</>'.
do.
search string for '<'.
if sy-subrc <> 0.
exit.
endif.
start = sy-fdpos.
search string for '>'.
end = sy-fdpos.
len = ( end - start ) + 1.
string+start(len) = space.
condense string.
enddo.
write:/ string.
check sy-subrc = 0.
Regards,
RIch Heilman
‎2006 Aug 21 10:43 PM
‎2006 Aug 21 10:58 PM
You can also use FM SOTR_TAGS_REMOVE_FROM_STRING. It seems to work for simple cases.
Rob
‎2006 Aug 21 11:19 PM
thanks to Rob.. I stumbled upon SOTR_STRING_PARSER which seems to be quite useful too..
~Suresh
‎2006 Aug 22 9:55 AM
Hello all,
thanks for your helpfull hints. The programm is now working properly.
Regards,
Kurt.