VB.Net program to demonstrate the UCase() function

Here, we are going to demonstrate the UCase() function in VB.Net.
Submitted by Nidhi, on December 04, 2020 [Last updated : March 05, 2023]

UCase() function in VB.Net

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

Syntax

UCase(Str)

Parameter(s)

  • Str: Specified string to be converted into uppercase

Return Value

The UCase() function will return the uppercase string.

VB.Net code to demonstrate the example of UCase() function

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

'VB.Net program to demonstrate the UCase() function.

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

Output:

Uppercase string: I LOVE INDIA
Press any key to continue . . .

Explanation:

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

UCaseStr = UCase(str)

In the above code, we used the UCase() function that will return the uppercase string. Then we printed the string on the console screen.

VB.Net Basic Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.