How to convert the first character of a string to upper case and the rest to lower case in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string str = "converts a STRING IN c#";
 
        str = str.Substring(0, 1).ToUpper() + str.Substring(1).ToLower();  
        
        Console.WriteLine(str); 
    }
}


 
 
/*
run:
 
Converts a string in c#
 
*/


answered Feb 21, 2015 by avibootz
edited Jul 18, 2022 by avibootz
...