Visual Basic Language Reference  

RSet Function

Returns a right-aligned string containing the specified string adjusted to the specified length.

Public Shared Function RSet( _
   ByVal Source As String, _
   ByVal Length As Integer _
) As String

Parameters

Source
Required. String expression. Name of string variable.
Length
Required. Integer expression. Length of returned string.

Remarks

If Source is longer than Length, RSet places only the leftmost characters, up to the length of Source, in the returned string. If the specified string is shorter than the specified length, spaces are added to the left end of the string to produce the appropriate length. If the specified string is longer than the specified length, it is shortened to the specified length.

Example

This example demonstrates the use of the RSet function.

Dim myString As String = "Right"
Dim rString As String
rString = RSet(myString, 11)   ' Returns "      Right"

See Also

Data Type Summary | LSet Function | Efficient Use of Data Types