crispy-strawberry/string.zig
A Rust like String type for Zig
Inspired by Rust's String
type.
Implementation mostly ported from Rust.
Provides helper functions that make working with strings easier.
I try to keep names consistent with std.ArrayList
build.zig.zon
in the project root if you don't already have one..string = .{
.url = "git+https://github.com/crispy-strawberry/string.zig#main",
}
zig build
and wait for zig to complain about the hash.string = .{
.url = "<repo url>",
.hash = "<the provided hash>"
}
build.zig
, add -const string = b.dependency("string", .{ .optimize = optimize, .target = target });
// Replace exe with whatever you are using.
exe.addModule("string", string.module("string"));
String
by-const String = @import("string").String;
const hello_world = try String.fromStr(allocator, "Hello World!");
std.debug.print("{}\n", .{hello_world.isAscii()});