
- 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 a character is a whitespace character
Set a character with WhiteSpace −
char c = ' ';
To check if a character is a whitespace character, use the char.IsWhiteSpace method −
if (char.IsWhiteSpace(c)) {}
Let us see the complete code −
Example
using System; class Demo { static void Main() { char c = ' '; if (char.IsWhiteSpace(c)) { Console.WriteLine("Whitespace character!"); } } }
Output
Whitespace character!
- Related Articles
- Check if a character is Space/Whitespace in Arduino
- PHP program to check if a string has a special character
- Check if a character is alphanumeric in Arduino
- Check if a character is printable in Arduino
- Python program to check if a string contains any unique character
- C# program to check if a string contains any special character
- Java program to check if a string contains any special character
- Check if a character is a punctuation mark in Arduino
- Program to check if a string contains any special character in C
- Program to check if a string contains any special character in Python
- How to check if a character is upper-case in Python?
- JAVA Menu Driven Program to Check Character is String, Number or Special Character
- C++ Program to Check Whether a character is Vowel or Consonant
- Java Program to Check Whether a Character is Alphabet or Not
- C++ Program to Check Whether a Character is Alphabet or Not

Advertisements