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

VB.Net program to demonstrate the RTrim() function

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

To remove the blank space on the right side, the RTrim() function is used.

Syntax :

RTrim(str)

Parameters :

  • Str : a string that has been specified that may contain blank space on the right side.

Return Value :

  • After removing blank space from the right side, the RTrim() function will return a string.

Program :

The source code to demonstrate the role of RTrim() is given below. The program given is compiled and successfully executed.


Module Module1
    Sub Main()
        Dim str1 As String = " I love india "
        Dim str2 As String = ""
        str2 = RTrim(str1)
        Console.WriteLine("Right Trimmed string: #{0}#", str2)
    End Sub
End Module
	
Output:
Right Trimmed string: # I love india#

Explanation:

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

str2 = RTrim(str1)

We used the RTrim() function in the code above, which will return the string after removing space from the right side. Then, on the console screen, we printed the string.


VB.Net Built-in Functions VB.Net program to demonstrate the InStr() function VB.Net program to demonstrate the UCase() function VB.Net program to demonstrate the LCase() function VB.Net program to demonstrate the Chr() function VB.Net program to demonstrate the Asc() function VB.Net program to demonstrate the Hex() function VB.Net program to demonstrate the Oct() function VB.Net program to demonstrate the Fix() function VB.Net program to demonstrate the CInt() function VB.Net program to demonstrate the CSByte() function VB.Net program to demonstrate the CShort() function VB.Net program to demonstrate the CUShort() function VB.Net program to demonstrate the CByte() function VB.Net program to demonstrate the CSng() function VB.Net program to demonstrate the CDbl() function VB.Net program to demonstrate the CDec() function VB.Net program to demonstrate the CLng() function VB.Net program to demonstrate the CULng() function VB.Net program to demonstrate the CStr() function VB.Net program to print date and time in 'dd/mm/yyyy hh:mm:ss' format using Format() function VB.Net program to print date and time in 'day, month dd, yyyy' format using Format() function VB.Net program to print date and time in different formats using Format() function VB.Net program to print given number in different formats using Format() function VB.Net program to demonstrate the CBool() function VB.Net program to demonstrate the Val() function VB.Net program to demonstrate the GetChar() function VB.Net program to reverse the given number using the While loop VB.Net program to check the given number is palindrome or not using While loop VB.Net program to count the digits of given number using While loop VB.Net program to check given number is Armstrong or not using While loop VB.Net program to print the table of given number using Do While VB.Net program to print 1, 11, 31, 61, ... using Do While Loop VB.Net program to Enter a name and print 5 times using Do While Loop VB.Net program to demonstrate the boxing VB.Net program to demonstrate the un-boxing VB.Net program to create a constant using const keyword VB.Net program to print the name of Enum constants VB.Net program to print the default values of Enum constants VB.Net program to print explicitly initialized values of Enum VB.Net program to create a global variable VB.Net program to create a simple class and object VB.Net program to create multiple objects of the class VB.Net program to create an array of objects of the class VB.Net program to create an empty class VB.Net program to demonstrate the Mid() function VB.Net program to demonstrate the Trim() function VB.Net program to demonstrate the LTrim() function VB.Net program to demonstrate the RTrim() function