转载自:http://blog.csdn.net/zhongguomao/article/details/13296165
尝试过用FM:PREPARE_STRING无法实现!
尝试过用SRELEN(Text)取长度的方法,繁琐!
后因为缜密思考,记录代码如下:
*&---------------------------------------------------------------------*
*& Report ZTEST_NUM
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZTEST_NUM.
DATA : SENT TYPE STRING VALUE '中国人民银行02520321456-25支行'.
DATA : NUMS TYPE STRING VALUE '1234567890-'.
DATA : LEN TYPE I.
DATA : POS TYPE I.
DATA : RESULT TYPE STRING.
LEN = STRLEN( SENT ).
POS = 0.
WHILE POS LT LEN.
IF SENT+POS(1) CA NUMS.
CONCATENATE RESULT SENT+POS(1) INTO RESULT.
CONDENSE RESULT NO-GAPS.
ENDIF.
POS = POS + 1.
ENDWHILE.
WRITE : SENT.
WRITE : / RESULT.
运行结果:
中国人民银行02520321456-25支行
02520321456-25
少年休闲海-2013/10/28记录