2010 Oct 18 1:43 PM
Plz help me
how to get numeric part from a string.
Eg. 17682442basic
i want the numeric part from the field ( numeric field length not fixed)
Plz help me
how to get numeric part from a string.
Eg. 17682442basic
i want the numeric part from the field ( numeric field length not fixed)
2010 Oct 18 1:58 PM
2010 Oct 18 2:21 PM
Hi,
Check the position of last character by using CA '0123456789'. And upto that position cut the string.
Amitava
2010 Oct 18 2:26 PM
I'd read the string left to right, one character at a time, until I found a character not in 1-9, by incrementing a counter and doing if string+counter(1) co '123456789'. etc.. When non-numeric character, the index (counter) is the length of the numeric part of the string.
2010 Oct 18 2:29 PM
Hi,
Try:
data: w_ss(10),
w_nn type i,
w_ii type i.
w_ss = '123abc'.
w_ii = 0.
while w_ii < strlen( w_ss ).
if not w_ss+w_ii(1) ca '0123456789'.
w_ss+w_ii(1) = ' '.
endif.
w_ii = w_ii + 1.
endwhile.
condense w_ss no-gaps.
w_nn = w_ss.
write w_nn.Best regards,
Lendro Mengue
2010 Oct 18 2:32 PM
Moderator message - Please do not ask or answer basic questions or questions that are easily searchable - thread locked Rob
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |