Sample code for 30+ languages & platforms
Zig

StringBuilder RemoveBefore

Demonstrates the StringBuilder.RemoveBefore method.

The GetBefore method was added in Chilkat v9.5.0.77

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

    const sb = try chilkat.StringBuilder.init();
    defer sb.deinit();
    try sb.append("http://www.chilkatsoft.com");

    // The RemoveBefore method removes the chars up to and including the marker string.
    // If the marker is not found, then nothing is removed and the method returns false.
    const marker = "//";
    const b_found = if (sb.removeBefore(marker)) true else |_| false;

    std.debug.print("bFound = {}\n", .{b_found});
    std.debug.print("sb contains: {s}\n", .{try sb.getAsString(alloc)});

    // Output is:
    // bFound = true
    // sb contains: www.chilkatsoft.com
}