Sample code for 30+ languages & platforms
Zig

StringBuilder GetAfterBetween

Demonstrates the GetAfterBetween method.

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();
    sb.append("<abc><person><name>Joe</name></person><company><name>Chilkat Software</name></company></abc>") catch {};

    // The GetAfterBetween method gets the substring between two arbitrary marker strings, and doesn't
    // start searching until the searchAfter string is passed.

    // For example, to get the company name in the string above...
    const search_after = "<company>";
    const company_name = try sb.getAfterBetween(alloc, search_after, "<name>", "</name>");
    std.debug.print("Company Name = {s}\n", .{company_name});
}