C# String ToUpper() Method Last Updated : 05 Mar, 2025 Comments Improve Suggest changes Like Article Like Report In C#, the ToUpper() method is used to convert all characters in a string to uppercase. If a character has an uppercase letter, it is converted, otherwise, it remains unchanged. Special characters and symbols are unaffected. This method is commonly used for case-insensitive comparisons and text formatting.Example 1: Basic Usage of ToUpper() Method C# // C# program to demonstrate ToUpper() method using System; class Geeks { public static void Main() { // Declare and initialize a string string s1 = "GeeksForGeeks"; // Convert string to uppercase string s2 = s1.ToUpper(); // Print original and converted strings Console.WriteLine("String Before Conversion: " + s1); Console.WriteLine("String After Conversion: " + s2); } } OutputString Before Conversion: GeeksForGeeks String After Conversion: GEEKSFORGEEKS Explanation: In this example, the ToUpper() method converts all lowercase letters in the string "GeeksForGeeks" to uppercase, resulting in "GEEKSFORGEEKS"Syntax of String ToUpper() Methodpublic string ToUpper();public string ToUpper(System.Globalization.CultureInfo culture);Parameters: culture (optional): A CultureInfo object that defines culture-specific casing rules.Return Type: The method returns a new string in which all characters have been converted to uppercase.Example 2: Using String.ToUpper() C# // C# program to demonstrate ToUpper() method using System; class Geeks { public static void Main() { // Declare and initialize a string string s1 = "This is C# Program xsdd_$#%"; // Convert string to uppercase string s2 = s1.ToUpper(); // Print the converted string Console.WriteLine(s2); } } OutputTHIS IS C# PROGRAM XSDD_$#% Explanation: In this example, all alphabetic characters in the string are converted to uppercase, while special characters remain unchanged.Example 3: Using String.ToUpper(CultureInfo) C# // C# program to demonstrate // ToUpper(CultureInfo) method using System; using System.Globalization; class Geeks { public static void Main() { // Declare and initialize a string string s1 = "This is C# Program xsdd_$#%"; // Convert string to uppercase using // English (United States) culture string s2 = s1.ToUpper(new CultureInfo("en-US", false)); // Print the converted string Console.WriteLine(s2); } } OutputTHIS IS C# PROGRAM XSDD_$#% Explanation: In this example, the ToUpper(CultureInfo) method allows specifying a culture for case conversion. It ensures the consistency across different language settings.Notes: The ToUpper() method does not modify the original string, it returns a new uppercase string.If the CultureInfo parameter is null, an ArgumentNullException is thrown.This method is useful for case-insensitive operations, such as string comparisons. Comment More infoAdvertise with us Next Article C# String ToUpper() Method M Mithun Kumar Follow Improve Article Tags : Misc C# CSharp-method CSharp-string Practice Tags : Misc Similar Reads C# String ToLower() Method In C#, the ToLower() method is a string method used to convert all uppercase characters in a string to lowercase. If a character does not have a lowercase equivalent, such as a special symbol, it remains unchanged. This method is particularly useful when performing case-insensitive string comparison 3 min read C# | String.ToUpperInvariant Method String.ToUpperInvariant Method is used to get a copy of this String object converted to uppercase using the casing rules of the invariant culture. Here "invariant culture" represents a culture that is culture-insensitive.Syntax: public string ToUpperInvariant (); Return Value: The return type of thi 2 min read C# | String.ToLowerInvariant Method String.ToLowerInvariant Method is used to get a copy of this String object converted to lowercase using the casing rules of the invariant culture. Here, "invariant culture" represents a culture that is culture-insensitive. Syntax: public string ToLowerInvariant (); Return value: The return type of t 2 min read toupper() function in C The toupper() function is used to convert lowercase alphabet to uppercase. i.e. If the character passed is a lowercase alphabet then the toupper() function converts a lowercase alphabet to an uppercase alphabet. It is defined in the ctype.h header file.Syntax: int toupper(int ch);Parameter: It accep 2 min read C# | Char.ToString() Method In C#, Char.ToString() is a System.Char struct method which is used to convert the value of this instance to its equivalent string representation. This method can be overloaded by passing different type of arguments to it. Char.ToString(IFormatProvider) Method Char.ToString(Char) Method Char.ToStrin 2 min read towupper() function in C/C++ The towupper() is a built-in function in C/C++ which converts the given wide character into uppercase. It is defined within the cwctype header file of C++. Syntax: wint_t towupper( wint_t ch ) Parameter: The function accepts a single mandatory parameter ch which specifies the wide character which we 2 min read Alternate Lower Upper String Sort Given a string containing lowercase and uppercase letters. Sort it in such a manner that the uppercase and lowercase letters come in an alternate manner but in a sorted way. Examples: Input : bAwutndekWEdkd Output :AbEdWddekkntuw Explanation: Here we can see that letter âAâ, âEâ, âWâ are sorted as w 6 min read strupr() function in c The strupr( ) function is used to converts a given string to uppercase. Syntax: char *strupr(char *str); Parameter: str: This represents the given string which we want to convert into uppercase. Returns: It returns the modified string obtained after converting the characters of the given string str 1 min read C# | ToCharArray() Method In C#, ToCharArray() is a string method. This method is used to copy the characters from a specified string in the current instance to a Unicode character array or the characters of a specified substring in the current instance to a Unicode character array. This method can be overloaded by changing 4 min read tolower() Function in C++ The C++ tolower() function converts an uppercase alphabet to a lowercase alphabet. It is a predefined function of ctype.h header file. If the character passed is an uppercase alphabet, then the tolower() function converts an uppercase alphabet to a lowercase alphabet. This function does not affect a 2 min read Like