是否有另一种连接方式而不是使用 CONCATENATE 关键字? [英] Is there another way to concatenate instead of using the CONCATENATE keyword?

查看:21
本文介绍了是否有另一种连接方式而不是使用 CONCATENATE 关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有另一种方法在 ABAP 中连接而不是使用 CONCATENATE 关键字?

Is there another way to concatenate in ABAP instead of using the CONCATENATE keyword?

一个使用CONCATENATE的例子:

DATA:
  foo    TYPE string,
  bar    TYPE string,
  foobar TYPE string.

  foo = 'foo'.
  bar = 'bar'.

  CONCATENATE foo 'and' bar INTO foobar SEPARATED BY space.

推荐答案

您可以(从 ABAP 7.02 开始)使用 && 连接两个字符串.

You can (starting with ABAP 7.02) use && to concatenate two strings.

Data:
foo    TYPE string,
bar    TYPE string,
foobar TYPE string.

foo = 'foo'.
bar = 'bar'.

foobar = foo && bar.

这也适用于 字符文字:

foobar = 'foo' && 'bar'.

为了保留空格,请使用这种名为文本字符串文字"的字符文字,它由两个 grave 定义重音(U+0060):

For preserving spaces, use this kind of character literal named "text string literal" which is defined with two grave accents (U+0060):

foobar = foo && ` and ` && bar

这篇关于是否有另一种连接方式而不是使用 CONCATENATE 关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆