Home >>VB.Net Built-in Functions >VB.Net program to demonstrate the UCase() function

VB.Net program to demonstrate the UCase() function

Write a VB.Net program to demonstrate the UCase() function

The UCase() function is used to convert the specified uppercase string.

Syntax :


Parameters :

  • Str: String specified to be converted to upper case

Return Value :

  • The uppercase string is returned by the UCase() function.

Program :

Below is the source code to demonstrate the UCase() function. The program given is compiled and successfully executed.

Module Module1
    Sub Main()
        Dim str As String = "I love india"
        Dim UCaseStr As String =""
        UCaseStr = UCase(str)
        Console.WriteLine("Uppercase string: {0}", UCaseStr)
    End Sub
End Module
Uppercase string: I LOVE INDIA


We created a Module1 module in the program above that contains the Main() method. We created two variables str and UCaseStr in the Main() method, where variable str is initialized with " I love india " and variable UCaseStr with a blank string is initialized.

UCaseStr = UCase(str)

We used the UCase() function in the above code that returns the uppercase string. Then, on the console screen, we printed the string.

No Sidebar ads