Char.ToUpperInvariant(Char) Method in C#

CsharpProgrammingServer Side Programming

The Char.ToUpperInvariant() method in C# is used to convert the value of a Unicode character to its uppercase equivalent using the casing rules of the invariant culture.

Syntax

public static char ToUpperInvariant (char ch);

Above, the parameter ch is the Unicode character to convert.

Let us now see an example to implement the Char.ToUpperInvariant() method −

Example

using System;
public class Demo {
   public static void Main(){
      char ch = 'q';
      char res = Char.ToUpperInvariant(ch);
      Console.WriteLine("Value = "+ch);
      Console.WriteLine("Uppercase Equivalent = "+res);
   }
}

Output

This will produce the following output −

Value = q
Uppercase Equivalent = Q

Let us now see another example −

Example

using System;
public class Demo {
   public static void Main(){
      char ch = 'r';
      char res = Char.ToUpperInvariant(ch);
      Console.WriteLine("Value = "+ch);
      Console.WriteLine("Uppercase Equivalent = "+res);
   }
}

Output

This will produce the following output −

Value = r
Uppercase Equivalent = R
raja
Updated on 04-Nov-2019 10:57:49

Advertisements