Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

23 Commits

Repository files navigation

A String struct made for Zig.

Inspired by this repo: https://github.com/clownpriest/strings/

To test:

$ cd zig-string/
$ zig test string.zig

Basic Usage:

conststd=@import("std");
constString=@import("/some/path/string.zig").String;
pubfnmain() !void {
varbuf: [1024]u8=undefined;
varfba=std.heap.ThreadSafeFixedBufferAllocator.init(buf[0..]);
vars=tryString.init(&fba.allocator, "hello, world");
defers.deinit();
varmatches=trys.findSubstringIndices(&fba.allocator, "hello");
deferfba.allocator.free(matches);
// Should print:// 0// hello, worldfor (matches) |val| {
std.debug.warn("{}\n", val);
}
std.debug.warn("{}\n", s.toSliceConst());
}

About

Strings for Zig

Topics

Resources

Stars

21 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages