我的代码有多行,我想在新行中写入某些行,如何在groovy body中实现

zpgglvta  于 2023-02-07  发布在  其他
关注(0)|答案(1)|浏览(131)
body:"""
Hi, how are you? Yes, I am doing good. what about you. How are things going?
Nothing interesting, as usual.
"""

在上面的行中,我想在groovy(body)中打印一个新行的句子,我该怎么做呢?我是新来的
我试过使用B标签,但没有任何效果。

pu82cl6c

pu82cl6c1#

你做得很对...

body:"""Hi, how are you?
Yes, I am doing good.
what about you.
How are things going?
Nothing interesting, as usual."""

您还可以向系统询问正确的行分隔符,因为它在不同的操作系统上可能会发生变化。

writer << "Line 1" + System.getProperty("line.separator") + "Line 2"

相关问题