- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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!
Advertisements