How to check if a string is pangram in C#

1 Answer

0 votes
// A string is a pangram if it contains all the characters of the alphabet ignoring case

using System;
using System.Linq;

class Program
{
    static bool isStringPangram(string str) {
        return str.ToLower().Where(ch => Char.IsLetter(ch)).GroupBy(ch => ch).Count() == 26;
    }    
    static void Main() {
        string str = "The quick brown fox jumps over the lazy dog";
        
        Console.WriteLine(isStringPangram(str));
    }
}




/*
run:

True

*/

 



answered Sep 14, 2023 by avibootz
edited Sep 14, 2023 by avibootz

Related questions

1 answer 125 views
125 views asked Sep 14, 2023 by avibootz
1 answer 123 views
123 views asked Sep 14, 2023 by avibootz
1 answer 138 views
138 views asked Sep 14, 2023 by avibootz
1 answer 117 views
1 answer 111 views
1 answer 132 views
...