Sample code for 30+ languages & platforms
Zig

Example: Crypt2.DecodeString method

Demonstrates how to call the DecodeString 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 crypt2 = try chilkat.Crypt2.init();
    defer crypt2.deinit();

    // The string "Hello World" in base64 (using the utf-8 byte representation) is "SGVsbG8gV29ybGQ="

    const encoded_str = "SGVsbG8gV29ybGQ=";
    const encoding = "base64";
    const charset = "utf-8";

    const str = try crypt2.decodeString(alloc, encoded_str, charset, encoding);
    std.debug.print("{s}\n", .{str});

    // Output is "Hello World"
}