如何在 Zig 中编写跨多行的字符串?
例如:
var str = `hello
second line
world
fourth line
`
Zig 具有这种奇怪但很酷的语法,其中包含以
\\
开头的多行以及下一行中的 ;
。
这是一个单例:
const str =
\\hello
\\second line
\\world
\\fourth line
;
这是一个由 2 个多行字符串组成的数组:
const array_of_multiline_strings = [_][]const u8{
\\hello
\\world
,
\\goodbye
\\world
};