字符串长度



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语句的可选添加,删除所有空格。





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值