String pad left
gyro add g-w1/leftpad
or add it to your projects build.zig.zon
zig build test
pad strings to the left
Usage:
const padded = try leftpad(allocator, "hope we dont have the npm problem", 3, '.');
defer allocator.free(padded);
expectEqualSlices(u8, "...hope we dont have the npm problem", padded);
Note: if supplied 0 for the 4th argument, ' ' will be used for the character to pad.