Sha256: 4c04a43b36aedccb39d671d994a8c23d398bba10faedd958b0f237a113882fa3
Contents?: true
Size: 471 Bytes
Versions: 86
Compression:
Stored size: 471 Bytes
Contents
use std::collections::BTreeSet; use std::iter::FromIterator; pub fn is_pangram(sentence: &str) -> bool { sentence.to_lowercase() .chars() .filter(|c| c.is_alphabetic()) .filter(|c| c.is_ascii()) .collect::<BTreeSet<char>>() == english_letter_set() } fn english_letter_set() -> BTreeSet<char> { BTreeSet::from_iter(ENGLISH_ALPHABET.chars()) } const ENGLISH_ALPHABET: &'static str = "abcdefghijklmnopqrstuvwxyz";
Version data entries
86 entries across 86 versions & 1 rubygems