Q:

How to convert string into uppercase in C#?

belongs to collection: C# Basic Programs | String programs

0

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

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.ToUpper()

String.ToUpper() Method returns uppercase converted string.

Syntax:

String String.ToUpper();

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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.ToUpper();
            
            Console.WriteLine("Converted string is: " + str2);

        }
    }
  
}

Output

Enter string : This Is India
Converted string is: THIS IS INDIA

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C# Basic Programs | String programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How to convert string into lowercase in C#?... >>
<< Explain String.Split() method of String class in C...