‎2009 Jun 24 2:12 PM
Hi all.
Does anyone know a FM that splits a string to numbers and characteristics ?
For example - string "56ddfdfhh hjhj 12 ggh fss 33s-yuyu" will give the following internal table:
56
ddfdfhh hjhj
12
ggh fss
33
s-yuyu
Thanks all,
Rebeka
‎2009 Jun 24 2:52 PM
Hello
Try this code:
data: str(100),
len type i,
counter type i,
symb.
data: begin of itab occurs 0,
flag,
str(20),
end of itab.
data: begin of xtab occurs 0,
str(20),
end of xtab.
str = '56ddfdfhh hjhj 12 ggh fss 33s-yuyu'.
len = strlen( str ).
do len times.
symb = str+counter(1).
itab-str = symb.
if symb CO '0123456789'.
itab-flag = 'N'.
else.
itab-flag = 'C'.
endif.
append itab.
counter = counter + 1.
enddo.
loop at itab.
at new flag.
clear xtab.
endat.
concatenate xtab-str itab-str into xtab-str.
at end of flag.
append xtab.
endat.
endloop.
‎2009 Jun 24 2:51 PM
You can use the FM
FIEB_EXTRACT_NUMBERS to extract the numbers
FIEB_EXTRACT_CHARACTERS to extract the characters.
Regards,
Naimesh Patel
‎2009 Jun 24 2:52 PM
Hello
Try this code:
data: str(100),
len type i,
counter type i,
symb.
data: begin of itab occurs 0,
flag,
str(20),
end of itab.
data: begin of xtab occurs 0,
str(20),
end of xtab.
str = '56ddfdfhh hjhj 12 ggh fss 33s-yuyu'.
len = strlen( str ).
do len times.
symb = str+counter(1).
itab-str = symb.
if symb CO '0123456789'.
itab-flag = 'N'.
else.
itab-flag = 'C'.
endif.
append itab.
counter = counter + 1.
enddo.
loop at itab.
at new flag.
clear xtab.
endat.
concatenate xtab-str itab-str into xtab-str.
at end of flag.
append xtab.
endat.
endloop.