| 1 | const std = @import("std"); |
| 2 | const string = []const u8; |
| 3 | const extras = @import("./lib.zig"); |
| 4 | |
| 5 | pub fn asciiLower(alloc: std.mem.Allocator, input: string) ![:0]u8 { |
| 6 | var buf = try alloc.dupeZ(u8, input); |
| 7 | for (input, 0..) |c, i| buf[i] = std.ascii.toLower(c); |
| 8 | return buf; |
| 9 | } |
| 10 | |
| 11 | pub fn asciiLowerComptime(comptime input: string) [:0]u8 { |
| 12 | var buf: [input.len + 1]u8 = undefined; |
| 13 | for (input, 0..) |c, i| buf[i] = std.ascii.toLower(c); |
| 14 | buf[input.len] = 0; |
| 15 | const result = buf[0..input.len :0]; |
| 16 | return result; |
| 17 | } |