PARAMETERS: P_STR TYPE CHAR20.
START-OF-SELECTION.
DATA: LV_ZH TYPE I.
DATA: LV_EN TYPE I.
PERFORM FRM_TRAN_GET_CHINESE USING P_STR CHANGING LV_ZH LV_EN.
WRITE: '汉字:' ,LV_ZH,/ '其它:',LV_EN.
*&---------------------------------------------------------------------*
*& Form frm_tran_get_chinese
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM FRM_TRAN_GET_CHINESE USING PV_STR CHANGING CV_ZH CV_EN.
DATA: LT_RESULT_TAB TYPE MATCH_RESULT_TAB.
DATA: LV_STRM1 TYPE STRING VALUE '[^\\u4E00-\\u9FA5\\uF900-\\uFA2D]'. " 汉字
DATA: LV_STRM2 TYPE STRING VALUE '[\\u4E00-\\u9FA5\\uF900-\\uFA2D]'. " 非汉字
DATA: LV_STR TYPE STRING.
LV_STR = PV_STR.
""提取汉字
FIND ALL OCCURRENCES OF REGEX LV_STRM1 IN LV_STR
RESULTS LT_RESULT_TAB.
DESCRIBE TABLE LT_RESULT_TAB[] LINES CV_ZH.
""非汉字
FIND ALL OCCURRENCES OF REGEX LV_STRM2 IN LV_STR
RESULTS LT_RESULT_TAB.
DESCRIBE TABLE LT_RESULT_TAB[] LINES CV_EN.
ENDFORM. "frm_tran_get_chinese
PARAMETERS: P_STR TYPE CHAR20.START-OF-SELECTION. DATA: LV_ZH TYPE I. DATA: LV_EN TYPE I. PERFORM FRM_TRAN_GET_CHINESE USING P_STR CHANGING LV_ZH LV_EN. WRITE: '汉字:' ,LV_ZH,/ '其它:',LV_EN.*&------------------------------------------------..