Coding Challenge to find the given string is a Pangram or not
Pangram is a string which will contain all the alphabets (a-z)
Example: "The quick brown fox jumps over the lazy dog"
Conditions:
* Spaces allowed in the input
* Check the given string contains at least once of all the alphabets a-z
* Case in sensitive
public static bool CheckIsPangram(string str)
{
List<string> LstAtoZ =
Enumerable.Range('A', 26)
.Select(x => (char)x + "")
.ToList();
str = str.Replace(" ", "");
foreach (char chr in str)
{
if (LstAtoZ.Contains(chr.ToString().ToUpper()))
{
LstAtoZ.Remove(chr.ToString().ToUpper());
}
}
return LstAtoZ.Count() == 0 ? true : false;
}
Thanks to Jon Skeet for this answer
Comments