fn getStringGeneric(opt_str: ?[]const u8, offset: u64) ![:0]const u8
fn getStringGeneric(opt_str: ?[]const u8, offset: u64) ![:0]const u8 { const str = opt_str orelse return bad(); if (offset > str.len) return bad(); const casted_offset = cast(usize, offset) orelse return bad(); // Valid strings always have a terminating zero byte const last = std.mem.findScalarPos(u8, str, casted_offset, 0) orelse return bad(); return str[casted_offset..last :0]; }