chore: Remove unused function for day1

This commit is contained in:
Kalle Carlbark 2023-12-02 17:59:56 +01:00
parent 25c51154bb
commit 7ac9a52892
No known key found for this signature in database

View file

@ -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;