Skip to content

Instantly share code, notes, and snippets.

View wrongrior's full-sized avatar

wrongrior wrongrior

View GitHub Profile
@Reijaff
Reijaff / stack_string.zig
Created January 20, 2023 21:22
convert string to stack string at compile time in zig
const std = @import("std");
fn stack_string(comptime string: []const u8) [string.len]u8{
var new_string: [string.len]u8 = undefined;
inline for (string) |chr, idx|{
new_string[idx] = chr;
}
return new_string;