用逗号连接字符串列表 [英] Join list of strings with a comma

查看:39
本文介绍了用逗号连接字符串列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 ABAP.过去我用的是python.

I am learning ABAP. In the past I used python.

Python: ', '.join(['one', 'two', 'three'])
Result: 'one, two, three'

如何使用 , 连接字符串列表并创建包含 one, two, Three 的字符串?

How can I join a list of strings with , and create a string containing one, two, three?

系统版本为 740.

推荐答案

另一种编写 CONCATENATE LINES OF ... 的方法是使用 7.40 函数 concat_lines_of( [table =] itab [sep = sep] )

Another way of writing CONCATENATE LINES OF ... is to use the 7.40 function concat_lines_of( [table =] itab [sep = sep] )

cl_demo_output=>display( concat_lines_of(
          table = value string_table( ( `one` ) ( `two` ) ( `three` ) )
          sep   = `, ` ) ).

(结果:'一,二,三')

(Result: 'one, two, three')

这篇关于用逗号连接字符串列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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