Static Methods for Characters in C#

There are several pre-defined methods available in C# to apply on characters. In this article, we discuss each method.

IsLetter(): This method used to check whether a specific character is a letter or not. It returns true for upper case & lower case letters and false for all others.

if (Char.IsLetter('F') == true)

{

}

IsUpper(): It returns true for upper case letters and false for lower case letters.

IsLower(): It returns true for lower case and false for upper case letters.

IsDigit(): It returns true for digits 0 to 9 and false for all other characters.

IsLetterOrDigit(): It returns true for letters and digits, false for all other characters.

IsNumber(): It returns true if given a character is a number and false for all others.

IsSeparator(): It returns true for space & all Unicode separator characters and false for all other characters.

IsWhiteSpace(): It returns true for all separators plus \n, \r, \t, \f, and \v & false for all others.

IsPunctuation(): It returns true for symbols used for punctuation in Western and other alphabets.

IsSymbol(): It returns true for MathSymbol, ModifierSymbol, OtherSymbol.

IsControl(): It returns true for Nonprintable “control” characters below 0x20, such as \r, \n, \t, \0, and characters between 0x7F and 0x9A.