"替换字符串中的某一个字符
DATA:lv_char TYPE c VALUE 'C01' LENGTH 10.
lv_char+0(1) = 'B'.
WRITE:lv_char.
OVERLAY lv_char WITH 'B' ONLY lv_char.
WRITE: / lv_char.
REPLACE FIRST OCCURRENCE OF 'C' IN LV_CHAR WITH 'B'.
WRITE: / lv_char.
此三种方法均能将C01转变成B01.
此处的类型是char如果是字符串则不能用第一种方法
要用replace来实现
DATA:lv_str TYPE string VALUE 'D01'.
REPLACE SECTION OFFSET 0 LENGTH 1 OF LV_STR WITH 'B'.
WRITE:/ lv_str.
阅读(1757) | 评论(0) | 转发(1) |