Skip to content

Instantly share code, notes, and snippets.

@MadLittleMods
Last active October 13, 2023 01:35
Show Gist options
  • Save MadLittleMods/f6682f4472d621142d608bfdf40eb6e1 to your computer and use it in GitHub Desktop.
Save MadLittleMods/f6682f4472d621142d608bfdf40eb6e1 to your computer and use it in GitHub Desktop.
Break-up long string across multiple lines in Zig (combine strings)
const std = @import("std");
// See "a ++ b" in the Zig docs: https://ziglang.org/documentation/master/#Operators
pub fn main() void {
std.log.debug(
"We can split up a really long string across multiple lines in Zig using " ++
"the ++ operator which works on comptime known arrays. Since comptime " ++
"strings look like `[100:0]const u8` indicating a null terminated array of " ++
"integers that is 100 characters long, this works just fine.",
.{},
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment