Do you think this is a good (reliable) way to get an end index of the sub slice?
const std = @import("std");
pub fn main() !void {
const slice = "hello world!";
const sub = slice[6..8];
std.log.debug("slice: {s}", .{slice});
std.log.debug("sub: {s}", .{sub});
std.log.debug("sub end: {d}", .{(@intFromPtr(sub.ptr) + sub.len) - @intFromPtr(slice.ptr)}); // also works without using *.ptr
}
output:
debug: slice: hello world!
debug: sub: wo
debug: sub end: 8