Created
April 2, 2020 11:00
-
-
Save olumidayy/cbe39aa455d3dbe51f811a7c4df7d85f to your computer and use it in GitHub Desktop.
day 9 mobile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
print(isPangram('Mr. Jock, TV quiz PhD., bags few lynx')); | |
print(isPangram('The quick brown fox jumps over the lazy dog.')); | |
} | |
String isPangram(sentence) { | |
// checks to see if the sentence contains at least one occurence each | |
// of all the English alphabets | |
String letters = 'abcdefghijklmnopqrstuvwxyz'; | |
sentence = sentence.toLowerCase(); | |
for (var i in letters.split('')) { | |
// taking each letter and comparing to the sentence | |
if(!sentence.contains(i)){ | |
// if the sentence doesn't contain one of the alphabets | |
return 'Not a Pangram'; | |
} | |
}return 'Is a Pangram'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment