VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-tolower-method/

⇱ C# String ToLower() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# String ToLower() Method

Last Updated : 5 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


Output
String 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


Output
String 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


Output
Original 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.
Comment
Article Tags:

Explore