How to split the numeric and character in string?
I have a problem with the split string to detach the numeric and character
I want the return value is u2018123.456u2019 ,removed the u2018abcdu2019
In this example the character u2018abcdu2019 maybe dynamic bits or value.
It can u2018abcu2019 or can u2018abcdeu2019 or can u2018abdu2019 etc..
How do to do it ?
Valter Oliveira replied
Are the letters always in the end? And starting in position 8? Or having the space between numbers and letters? This is usefull info that could allow us to give you the BEST solution.
However, I'll give you a generic solution that will allways work (I hope ).
DATA: lenght TYPE i, pos(2) TYPE n, str1 TYPE char255 VALUE '123.456 abcd'. lenght = strlen( str1 ). CLEAR pos. DO lenght TIMES. IF NOT str1+pos(1) CO '0123456789.'. CLEAR str1+pos(1). ENDIF. ADD 1 TO pos. ENDDO. CONDENSE str1.