用正则表达式。 DATA:MATCHER TYPE REF TO CL_ABAP_MATCHER. DATA:MATCH TYPE C LENGTH 1. DATA:STR(10) TYPE C. STR = '12345'. MATCHER = CL_ABAP_MATCHER=>CREATE( PATTERN = '\d+' TEXT = STR ). MATCH = MATCHER->MATCH( ). 如果MATCH = 'X',则该字符串即为满足正则表达式的变量。
用正则表达式。 DATA:MATCHER TYPE REF TO CL_ABAP_MATCHER. DATA:MATCH TYPE C LENGTH 1. DATA:STR(10) TYPE C. STR = '12345'. MATCHER = CL_ABAP_MATCHER=>CREATE( PATTERN = '\d+' TEXT = STR ). MATCH = MATCHER->MATCH( ). 如果MATCH = 'X',则该字符串即为满足正则表达式的变量。