gpt4 book ai didi

raku - 如何拆分我想在 Perl 6 中打印的长字符串?

转载 作者:行者123 更新时间:2023-12-01 08:49:12 24 4
gpt4 key购买 nike

say "This is a very long line, and it seems it will not fit my screen, but alas, I don't know how to split it without getting an additional newline";

如何将 "..." 拆分成几行(我的意思是在代码中)而不在输出中获得不需要的换行符?我在换行之前考虑过 \ ,但它不起作用。

最佳答案

您的示例作为引用的单词 here-doc

say qw:to<END>.join: ' ';
This is a very long line, and it seems it will not fit my
screen, but alas, I don't know how to split it without getting
an additional newline
END

如果输出是一行并且输入是空格分隔的单词列表,则通常有效。

也可以在线引用和加入:

say q:to<END>.lines.join: ' ';
This is a very long line, and it seems it will not fit my
screen, but alas, I don't know how to split it without
getting an additional newline
END

在每一行中保留格式。

关于raku - 如何拆分我想在 Perl 6 中打印的长字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47064102/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com