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

CsharpProgrammingServer Side Programming

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();
      }
   }
}
raja
Published on 13-Aug-2018 16:11:56
Advertisements