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

Version Path
trackler-2.2.1.179 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.178 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.177 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.176 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.175 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.174 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.173 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.172 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.171 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.170 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.169 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.167 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.166 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.165 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.164 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.163 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.162 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.161 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.160 tracks/rust/exercises/pangram/example.rs
trackler-2.2.1.159 tracks/rust/exercises/pangram/example.rs