Currently i’m learning zig for personal purpose. I treid to process the large csv file to get one column and printed out spesific value on that column .
Here’s the part of the code
while (true) {
reader.streamUntilDelimiter(arr.writer(), '\n', null) catch |err| switch (err) {
error.EndOfStream => break,
else => return err,
};
// getting line to read
const line = arr.items;
// std.debug.print("{s}", .{line});
// Split the line by delimiter (e.g., comma, tab, space) to get columns
const columns = std.mem.split(u8, line, ',');
// Filter specific column (e.g., column index 1)
const specificColumnIndex = 1;
if (specificColumnIndex < columns.len) {
const specificColumn = columns[specificColumnIndex];
std.debug.print("{s}\n", .{specificColumn}); // Print the specific column
}
arr.clearAndFree();
}
getting error "
src/main.zig:35:49: error: expected type '[]const u8', found 'comptime_int'
const columns = std.mem.split(u8, line, ',');
"
I dont know how to address this error