Skip to content

Instantly share code, notes, and snippets.

View er-contreras's full-sized avatar
❤️‍🔥

Erick Contreras er-contreras

❤️‍🔥
View GitHub Profile
@syntacticsugar
syntacticsugar / Detect_Pangram.rb
Created April 9, 2020 03:37
A pangram is a sentence that contains every single letter of the alphabet at least once. For example, the sentence "The quick brown fox jumps over the lazy dog" is a pangram, because it uses the letters A-Z at least once (case is irrelevant). Given a string, detect whether or not it is a pangram. Return True if it is, False if not. Ignore number…
#https://www.codewars.com/kata/545cedaa9943f7fe7b000048/train/ruby
def panagram? str
chars_only = ->(string) {string.split('').map(&:downcase).uniq.select{ |c| c =~ /[[:alpha:]]/ }}
chars_only[str].size.eql? 26
end
def panagram?(string)
('a'..'z').all? { |x| string.downcase.include? (x) }
end