.ToLower() method is a string method in C# that returns a new string in which all the characters are converted to lowercase.
The method does not modify the original string, but rather returns a new one. This method is helpful in normalizing user input or comparing strings in a case-insensitive manner.
myString is the string being converted to lowercase.
In the following example, the
.ToLower() method is called on a string
originalString, and is printed to the console:
using System;string originalString = "HELLO WORLD";Console.WriteLine(originalString.ToLower()); // Output: "hello world"
In following runnable example, a new string
originalString is created that contains some text. Then, the
.ToLower() method is called on this string and the result is stored in a new string variable
lowerCaseString. Finally, both the original and the lowercase strings are printed to the console.
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.