Sample code for 30+ languages & platforms
Zig

StringBuilder EntityDecode

Demonstrates the Chilkat StringBuilder EntityDecode method to decode HTML entities.

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();

    // Decode the following HTML entities, replacing each with the character represented.
    const s = "é é é Latin small letter e with acute";

    const sb = try chilkat.StringBuilder.init();
    defer sb.deinit();

    sb.append(s) catch {};
    sb.entityDecode() catch {};

    // Output: é é é Latin small letter e with acute
    std.debug.print("{s}\n", .{try sb.getAsString(alloc)});
}