mirror of
https://github.com/MorizzG/aoc-2024.git
synced 2025-12-06 04:22:43 +00:00
day 11 done
This commit is contained in:
parent
e0ceda6bb0
commit
d06f8527ff
13 changed files with 211 additions and 34 deletions
|
|
@ -92,12 +92,14 @@ pub fn NumberParser(comptime T: type) type {
|
|||
};
|
||||
}
|
||||
|
||||
pub fn numberParser(comptime T: type, input: []const u8) NumberParser(T) {
|
||||
return NumberParser(T){ .token_it = std.mem.tokenizeScalar(u8, input, ' ') };
|
||||
pub fn numberParserWithDelimiter(comptime T: type, input: []const u8, delimiter: u8) NumberParser(T) {
|
||||
const input_trimmed = std.mem.trim(u8, input, "\n");
|
||||
|
||||
return NumberParser(T){ .token_it = std.mem.tokenizeScalar(u8, input_trimmed, delimiter) };
|
||||
}
|
||||
|
||||
pub fn numberParserWithDelimiter(comptime T: type, input: []const u8, delimiter: u8) NumberParser(T) {
|
||||
return NumberParser(T){ .token_it = std.mem.tokenizeScalar(u8, input, delimiter) };
|
||||
pub fn numberParser(comptime T: type, input: []const u8) NumberParser(T) {
|
||||
return numberParserWithDelimiter(T, input, ' ');
|
||||
}
|
||||
|
||||
pub fn allocGrid(comptime T: type, alloc: std.mem.Allocator, n: usize, m: usize) ![][]T {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue