
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
C# program to check if string is panagram or not
A pangram has all the 26 letters of an alphabet.
Below, we have entered a string, and will check whether it is a pangram or not −
string str = "The quick brown fox jumps over the lazy dog";
Now, check using the ToLower(), isLetter() and Count() functions that the string has all the 26 letters of not since pangram has all the 26 letters of an alphabet.
Example
You can try to run the following code to check whether a string is pangram or not.
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; } } }
Output
True: "The quick brown fox jumps over the lazy dog" is pangram
- Related Articles
- Swift program to check if string is pangram or not
- Python program to check if a string is palindrome or not
- Java Program to check if a string is empty or not
- Python program to check if the string is empty or not
- C# program to check if a string is palindrome or not
- C program to check if a given string is Keyword or not?
- Python program to check if a given string is Keyword or not
- Swift Program to check if a given string is Keyword or not
- C++ Program to check string is strictly alphabetical or not
- Program to check the string is repeating string or not in Python
- Python - Check if a given string is binary string or not
- C Program to check if matrix is singular or not
- Program to check a string is palindrome or not in Python
- Program to check given string is pangram or not in Python
- C++ program to check whether given string is bad or not

Advertisements