创建字符串
data my_char(5) value 'hello'.
字符串长度
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.
9
| 函数 | 说明 |
|---|---|
| concatenate | 两个字符串连接形成第三个字符串 |
| condense | 此语句删除空格字符 |
| strlen | 用于查找字段的长度 |
| replace | 用于以字符进行替换 |
| search | 在字符串中运行搜索 |
| shift | 用于向左或向右移动字符串的内容 |
| split | 用于将字段的内容拆分为两个或多个字段 |
report yt_sep_15.
data: title_1(10) value 'tutprials',
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.