Home >Backend Development >C#.Net Tutorial >C# program to check if a string is a full word
Full Grammar contains all 26 letters of the alphabet.
Below, we input a string and will check if it is full syntax. -
string str = "The quick brown fox jumps over the lazy dog";
Now, use ToLower(), isLetter() and Count() functions to check if the string contains all 26 letters of not because pangram contains all 26 letters of the alphabet.
ExampleYou can try running the following code to check if the string is a pangram.
Live Demo
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Demo { public class Program { public static void Main(string []arg) { string str = "The quick brown fox jumps over the lazy dog"; Console.WriteLine("{0}: \"{1}\" is pangram", checkPangram(str), str); Console.ReadKey(); } static bool checkPangram(string str) { return str.ToLower().Where(ch => Char.IsLetter(ch)).GroupBy(ch => ch).Count() == 26; } } }
True: "The quick brown fox jumps over the lazy dog" is pangram
The above is the detailed content of C# program to check if a string is a full word. For more information, please follow other related articles on the PHP Chinese website!