RTrim Function in VB.NET
How to use the RTrim Function in VB.NET?
RTrim FunctionRtrim(), Right Trim String Function
in Visual Basic.net 2008 returns a copy of a string by removing the trailing whitespaces.
Function RTrim(ByVal Str As String) As String
In the above syntax, the Str
is the string from which the trailing white spaces are removed.
Dim Str As String = "
Dim Pre As String = "Prefix"
Dim Sfx As String = "Suffix"
Console.WriteLine("String after removing
trailing spaces:: " & Pre + RTrim(Str) + Sfx)
String after removing trailing spaces:: Prefix HIISuffix
In the above example, three spaces are included in the string 'HII' to its prefix, sufix. Using
the RTrim Right trim string function only, the trailing spaces are removed and concatenated with string to find it.