exercism/zig/pangram/pangram.zig

19 lines
350 B
Zig
Raw Permalink Normal View History

const ascii = @import("std").ascii;
pub fn isPangram(str: []const u8) bool {
var alphabet = [_]u8{0} ** 26;
for (str) |c| {
if (!ascii.isAlphabetic(c)) {
continue;
}
alphabet[ascii.toLower(c) - 97] += 1;
}
for (alphabet) |count| {
if (count == 0) return false;
}
return true;
}