Char.IsUpper() Method in C#

The Char.IsUpper() method in C# determines whether a specified Unicode character is categorized as an uppercase letter. It returns true if the character is an uppercase letter, otherwise false.

Syntax

Following is the syntax of the Char.IsUpper() method −

public static bool IsUpper(char ch);

Parameters

  • ch − The Unicode character to evaluate.

Return Value

This method returns a bool value −

  • true if the character is an uppercase letter

  • false if the character is not an uppercase letter

Using Char.IsUpper() with Uppercase Letter

The following example demonstrates checking an uppercase letter 'H' −

using System;

public class Demo {
   public static void Main() {
      bool res;
      char val = 'H';
      Console.WriteLine("Value = " + val);
      res = Char.IsUpper(val);
      Console.WriteLine("Is the value an uppercase letter? = " + res);
   }
}

The output of the above code is −

Value = H
Is the value an uppercase letter? = True

Using Char.IsUpper() with Lowercase Letter

The following example demonstrates checking a lowercase letter 'j' −

using System;

public class Demo {
   public static void Main() {
      bool res;
      char val = 'j';
      Console.WriteLine("Value = " + val);
      res = Char.IsUpper(val);
      Console.WriteLine("Is the value an uppercase letter? = " + res);
   }
}

The output of the above code is −

Value = j
Is the value an uppercase letter? = False

Testing Multiple Characters

This example shows how to check multiple characters including letters, digits, and special characters −

using System;

public class Demo {
   public static void Main() {
      char[] characters = {'A', 'z', '5', '@', 'M', 'p'};
      
      foreach (char ch in characters) {
         bool isUpper = Char.IsUpper(ch);
         Console.WriteLine("'" + ch + "' is uppercase: " + isUpper);
      }
   }
}

The output of the above code is −

'A' is uppercase: True
'z' is uppercase: False
'5' is uppercase: False
'@' is uppercase: False
'M' is uppercase: True
'p' is uppercase: False

Conclusion

The Char.IsUpper() method is a useful utility for character validation in C#. It specifically identifies uppercase Unicode letters and returns false for lowercase letters, digits, symbols, and other non-uppercase characters.

Updated on: 2026-03-17T07:04:35+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements