Home » .Net

How to convert string into lowercase in C#?

Here, we will learn how to convert string into lowercase? To convert string into lowercase we have a predefined method of String class String.ToLower(), which returns the string in lowercase.

Given a string in any case (lower, upper, proper or mixed case) and we have to convert into Lowercase.

For Example:

1) Input String: "This is india" then it will convert into : "this is india".
2) Input String: "This Is India" then it will convert into : "this is india".
3) Input String: "this is india" then it will convert into : "this is india".
4) Input String: "tHIS iS iNDIA" then it will convert into : "this is india".    
    

String.ToLower()

String.ToLower() Method returns lowercase converted string.

Syntax:

String String.ToLower();

Consider the program:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            String str1;
            String str2;

            Console.Write("Enter string : ");
            str1 = Console.ReadLine();

            str2 =str1.ToLower();
            
            Console.WriteLine("Converted string is: " + str2);
        }
    }
  
}

Output

Enter string : This Is India
Converted string is: this is india





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.