How to convert Lower case to Upper Case using C#?


To convert Lower case to Upper case, use the ToUpper() method in C#.

Let’s say your string is −

str = "david";

To convert the above lowercase string in uppercase, use the ToUpper() method −

Console.WriteLine("Converted to UpperCase : {0}", str.ToUpper());

The following is the code in C# to convert character case −

Example

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

namespace Demo {
   class MyApplication {
      static void Main(string[] args) {

         string str;
         str = "david";
         Console.WriteLine("LowerCase : {0}", str);

         // convert to uppercase
         Console.WriteLine("Converted to UpperCase : {0}", str.ToUpper());
         Console.ReadLine();
      }
   }
}

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 21-Jun-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements