Strings In Depth6 / 19
Up next

len counts bytes

const std = @import("std");

pub fn main() void {
    // 'e-acute' is two UTF-8 bytes, so len is 4 for "cafe"
    const s = "caf\u{e9}";
    std.debug.print("{s} is {d} bytes\n", .{ s, s.len });
}
What you're solving

len is byte length, not char count