ABAP 字符串替换(保留后空格)

 

DATA: lc_str1 TYPE char120 VALUE '123&123&321'.
DATA: lc_str2 TYPE char120 VALUE '123&123&321'.
DATA itab TYPE TABLE OF string.

SPLIT lc_str1 AT '&' INTO TABLE itab.
CONCATENATE LINES OF itab INTO lc_str1 SEPARATED BY ' and '.
WRITE lc_str1.

REPLACE ALL OCCURRENCES OF '&' IN lc_str2 WITH ' and '.
WRITE lc_str2.

 

posted @ 2022-08-01 09:19  做梦都笑醒  阅读(519)  评论(0编辑  收藏  举报