2007 Feb 09 4:11 AM
Hi All,
I have issue regarding removing characters other than numeric numbers from a field.
<b>How we can remove characters other than numeric numbers from a field!</b>
Ex:
<b>* Begin Of Modification - 671235785</b>
Now from above commented line of code i want to remove all the characters <b>* - Begin Of Modification and all spaces and capture 671235785 only.</b>
How can i solve this issue!
Thanks in advance.
Thanks,
Deep.
2007 Feb 09 4:14 AM
2007 Feb 09 4:14 AM
2007 Feb 09 4:19 AM
data : len type i,
pos type i,
v_temp,
f1(15).
len = strlen( str ).
do len times.
v_temp = str+pos(1).
if v_temp ca '0123456789.'.
concatenate f1 v_temp into f1.
endif.
pos = pos + 1.
enddo.
in f1 you have the required value
Regards
Ravi
2007 Feb 09 4:20 AM
data: str(100) type c.
data: str_n type string.
data: str_c type string.
data: len type i.
data: ofst type i.
str = '#ABCD%12344'.
len = strlen( str ).
do.
if ofst = len.
exit.
endif.
if str+ofst(1) co sy-abcde.
concatenate str_c str+ofst(1) into str_c.
else.
concatenate str_n str+ofst(1) into str_n.
endif.
ofst = ofst + 1.
enddo.
write:/ str.
write:/ str_c.
write:/ 'spacial chracter',20 str_n.
kishan negi
2007 Feb 09 4:28 AM
Hi Deep,
Check out this sample of code :.
DATA : mytext TYPE char50,
mytext1 TYPE char50,
mytext2.
mytext = '* Begin Of Modification - 671235785'.
DATA : i TYPE i,
len TYPE i.
i = 0.
len = STRLEN( mytext ).
DO len TIMES.
IF mytext+i(1) CA '0123456789'.
mytext2 = mytext+i(1).
CONCATENATE mytext1 mytext2 INTO mytext1.
ENDIF.
i = i + 1.
ENDDO.
WRITE 😕 mytext1.
-SatyaPriya