From 7ac9a5289289da1cd22462734ec0a03af97b6be8 Mon Sep 17 00:00:00 2001 From: Kalle Carlbark Date: Sat, 2 Dec 2023 17:59:56 +0100 Subject: [PATCH] chore: Remove unused function for day1 --- src/day01.zig | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/src/day01.zig b/src/day01.zig index 0d5f2b7..083027e 100644 --- a/src/day01.zig +++ b/src/day01.zig @@ -17,46 +17,11 @@ pub fn main() !void { const part01_total = try part01(allocator, data); const part02_total = try part02(allocator, data); + std.debug.print("Part01: {d}\n", .{part01_total}); std.debug.print("Part02: {d}\n", .{part02_total}); } -fn replace_number_with_digit(allocator: std.mem.Allocator, word: []const u8) ![]u8 { - var size = std.mem.replacementSize(u8, word, "one", "1"); - const output = try allocator.alloc(u8, size); - _ = std.mem.replace(u8, word, "one", "1", output); - - size = std.mem.replacementSize(u8, output, "two", "2"); - const output2 = try allocator.alloc(u8, size); - _ = std.mem.replace(u8, output, "two", "2", output2); - - size = std.mem.replacementSize(u8, output2, "three", "3"); - const output3 = try allocator.alloc(u8, size); - _ = std.mem.replace(u8, output2, "three", "3", output3); - - size = std.mem.replacementSize(u8, output3, "four", "4"); - const output4 = try allocator.alloc(u8, size); - _ = std.mem.replace(u8, output3, "four", "4", output4); - size = std.mem.replacementSize(u8, output4, "five", "5"); - const output5 = try allocator.alloc(u8, size); - _ = std.mem.replace(u8, output4, "five", "5", output5); - size = std.mem.replacementSize(u8, output5, "six", "6"); - const output6 = try allocator.alloc(u8, size); - _ = std.mem.replace(u8, output5, "six", "6", output6); - size = std.mem.replacementSize(u8, output6, "seven", "7"); - const output7 = try allocator.alloc(u8, size); - _ = std.mem.replace(u8, output6, "seven", "7", output7); - size = std.mem.replacementSize(u8, output7, "eight", "8"); - const output8 = try allocator.alloc(u8, size); - _ = std.mem.replace(u8, output7, "eight", "8", output8); - size = std.mem.replacementSize(u8, output8, "nine", "9"); - const output9 = try allocator.alloc(u8, size); - _ = std.mem.replace(u8, output8, "nine", "9", output9); - - // std.debug.print("REPLACED {s}\n", .{output9}); - return try allocator.dupe(u8, output9); -} - fn find_first_digit_number(word: []const u8) !u8 { var i: usize = 0;