find and solve || findandsolve.com
Please wait.....

C# String ToUpperInvariant()

In the c# String. ToUpperInvariant() method used to return a copy of this String object which is converted to uppercase using the casing rules of the invariant culture.

Syntax

public string ToUpperInvariant()

Return Value: The return type of this method is System.String. This method will return a string which is the uppercase equivalent of the current string.

Example

using System;
public class Program
{
 public static void Main()
 {
    string str = "Hello FindAndSolve";
    string str1 = str.ToUpperInvariant();
    Console.WriteLine(str1);
 }
}

Output

HELLO FINDANDSOLVE


Another Example

using System;
public class Program
{
  public static void Main()
    {
        // Calling function
        Convert("FindAndSolve");
        Convert("findandsolve");
        Convert("FIINDANDSOLVE");
    }
    static void Convert(String param)
    {
        // Display strings
        Console.WriteLine("string 1: {0}", param);
        // Convert sting into Uppercase
        // using ToUpperInvariant() method
        param = param.ToUpperInvariant();
        // Display the Lowercase strings
        Console.WriteLine("string 2: {0}", param);
    }
}

Output

string 1: FindAndSolve

string 2: FINDANDSOLVE

string 1: findandsolve

string 2: FINDANDSOLVE

string 1: FIINDANDSOLVE

string 2: FIINDANDSOLVE