REPORT YT_SEP_15.
DATA: title_1(10) VALUE 'Tutorials',
length_1 TYPE I.
length_1 = STRLEN( title_1 ).
Write: / 'The Length of the Title is:', length_1.
上面的代码产生以下输出 -
The Length of the Title is: 9
输出字符是否需要空格:
REPORT YT_SEP_15.
DATA: title_1(10) VALUE 'Tutorials',
title_2(10) VALUE 'Point',
spaced_title(30) VALUE 'Tutorials Point Limited',
sep,
dest1(30),
dest2(30).
CONCATENATE title_1 title_2 INTO dest1.
Write: / 'Concatenation:', dest1.
CONCATENATE title_1 title_2 INTO dest2 SEPARATED BY sep.
Write: / 'Concatenation with Space:', dest2.
CONDENSE spaced_title.
Write: / 'Condense with Gaps:', spaced_title.
CONDENSE spaced_title NO-GAPS.
Write: / 'Condense with No Gaps:', spaced_title.
输出结果:
Concatenation: TutorialsPoint Concatenation with Space: Tutorials Point Condense with Gaps: Tutorials Point Limited Condense with No Gaps: TutorialsPointLimited
注意:
-
在Concatenation的情况下,'sep'在字段之间插入一个空格。
-
CONDENSE语句删除字段之间的空格,但只留下1个字符的空格。
-
'NO-GAPS'是CONDENSE语句的可选添加,删除所有空格。