Zig
Zig
Load StringTable from a StringBuilder
Demonstrates how to load a StringTable from the text contained in a Chilkat StringBuilder object.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
const str_tab = try chilkat.StringTable.init();
defer str_tab.deinit();
const sb = try chilkat.StringBuilder.init();
defer sb.deinit();
sb.append("This is line 1\r\n") catch {};
sb.append("An empty line follows...\r\n") catch {};
sb.append("\r\n") catch {};
sb.append("This is line 4\r\n") catch {};
str_tab.appendFromSb(sb) catch {};
var i: i32 = 0;
const num_strings = str_tab.getCount();
while (i < num_strings) {
std.debug.print("{d}: {s}\n", .{ i, try str_tab.stringAt(alloc, i) });
i = i + 1;
}
}