You can also use
std.mem.splitAny()
Or
std.mem.splitSequence()
const std = @import("std");
pub fn main() !void{
const input = "Hello World";
//this is to split by spaces
var iter = std.mem.splitAny(u8, input, " ");
while (iter.next()) |word| {
std.debug.print("{s}\n", .{word});
}
}