ABAP提取汉字

2023-10-13 19:22:37 浏览数 (1)

代码语言:javascript复制
REPORT Y_CLY_GET_CN_CHAR.

START-OF-SELECTION.

  DATA: LV_STR TYPE STRING.
  LV_STR = 'afdfas建昌df县老大杖asdfd子加油站adFdf发adf、dfas'.

  DATA: LV_ARKTX TYPE STRING.
  DATA: LT_RESULT_TAB TYPE MATCH_RESULT_TAB,
        LT_WA LIKE LINE OF LT_RESULT_TAB.


  ""提取汉字
  FIND ALL OCCURRENCES OF REGEX '[^x00-xff]*' IN LV_STR
      RESULTS LT_RESULT_TAB.
  LOOP AT LT_RESULT_TAB INTO LT_WA WHERE LENGTH <> 0.
    WRITE: / LV_STR LT_WA-OFFSET(LT_WA-LENGTH).
  ENDLOOP.

0 人点赞