C# String ToLower() Method
Last Updated :
05 Mar, 2025
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 comparisons or formatting text.
Example 1: Basic Usage of ToLower() Method
C#
// C# program to demonstrate the
// use of ToLower() method
using System;
class Geeks
{
public static void Main()
{
// Original string
string s1 = "GeeksForGeeks";
// Convert string to lowercase
string s2 = s1.ToLower();
// Display results
Console.WriteLine("String before conversion: " + s2);
Console.WriteLine("String after conversion: " + s2);
}
}
OutputString before conversion: geeksforgeeks
String after conversion: geeksforgeeks
Explanation: In this example, the method converts all uppercase letters to lowercase while keeping other characters unchanged.
Syntax of String ToLower() Method
This method can be overloaded by passing the different types of arguments to it.
public string ToLower ();
public string ToLower(System.Globalization.CultureInfo culture);
- Parameter: culture: A CultureInfo object that defines culture-specific casing rules.
- Return Type: It returns the string value, which is the lowercase equivalent of the string of type System.String. The second method does the same but according to the specified culture.
- Exception: Throws ArgumentNullException if culture is null.
Example 2: Handling Special Characters
C#
// C# program to demonstrate the
// use of ToLower() method with special characters
using System;
class Geeks
{
public static void Main()
{
// Original string with special symbols
string s1 = "This is C# Program XSDD_$#%";
// Convert to lowercase
string s2 = s1.ToLower();
Console.WriteLine("String before conversion: " + s1);
Console.WriteLine("String after conversion: " + s2);
}
}
OutputString before conversion: This is C# Program XSDD_$#%
String after conversion: this is c# program xsdd_$#%
Explanation: In this example, the method converts uppercase letters to lowercase while special symbols remain unchanged.
Example 3: Using ToLower() with CultureInfo
C#
// C# program to demonstrate the
// use of ToLower(CultureInfo) method
using System;
using System.Globalization;
class Geeks
{
public static void Main()
{
// Original string
string s1 = "THIS IS C# PROGRAM XSDD_$#%";
// Convert to lowercase using English-US culture
string s2 = s1.ToLower(new CultureInfo("en-US", false));
Console.WriteLine("Original string: " + s1);
Console.WriteLine("String after conversion: " + s2);
}
}
OutputOriginal string: THIS IS C# PROGRAM XSDD_$#%
String after conversion: this is c# program xsdd_$#%
Explanation: In this example, the method uses culture-specific rules to convert uppercase letters to lowercase.
Important Points:
- The ToLower() method converts all uppercase characters in a string to lowercase.
- Special characters and symbols remain unchanged.
- The method does not modify the original string but returns a new one.
- The overloaded ToLower(CultureInfo) allows culture-specific conversions.
Similar Reads
C# String ToUpper() Method 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 form
2 min read
C# String ToUpper() Method 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 form
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
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
JavaScript String toLowerCase() Method The JavaScript toLowerCase() method converts all characters in a string to lowercase, returning a new string without modifying the original. It's commonly used for case-insensitive comparisons, standardizing text input, or formatting strings by ensuring all characters are in lowercase.Syntax:str.toL
2 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