2019 Dec 10 1:11 AM
Dear Expert,
How do you find the position of first occurrence number in a string?
string = 'abcde782ss'.
Thanks
2019 Dec 10 4:45 AM
Sam Indra Try below REGEX, moff will return as 5, which means number starts from 6 and mlen will return as 3 as there are 3 continuous numbers.
DATA: moff TYPE i,
mlen TYPE i.
FIND REGEX '([0-9]+)' IN 'abcde782ss'
MATCH OFFSET moff
MATCH LENGTH mlen.
2019 Dec 10 4:45 AM
Sam Indra Try below REGEX, moff will return as 5, which means number starts from 6 and mlen will return as 3 as there are 3 continuous numbers.
DATA: moff TYPE i,
mlen TYPE i.
FIND REGEX '([0-9]+)' IN 'abcde782ss'
MATCH OFFSET moff
MATCH LENGTH mlen.
2019 Dec 10 5:04 AM
Hi,
This should work.
DATA text TYPE string.
text = 'YTD<J KHGYGJNKLJKKN777GLHGKLB'.
IF text CA '1234567890'.
write:/ sy-fdpos.
ENDIF.
2019 Dec 10 9:06 AM
Or even:
ASSERT 4 = find_any_of( val = `wwxx7yy` sub = `0123456789` ).
2019 Dec 10 3:51 PM
New thing learnt for today, thanks Sandra Rossi for sharing 🙂