This documentation is archived and is not being maintained.

LSet Function

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

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


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


If the specified string is longer than the specified length, the returned string is shortened to the specified length. If the specified string is shorter than the specified length, spaces are added to the right end of the returned string to produce the appropriate length.


This example demonstrates the use of the LSet function.

Dim myString As String = "Left"
Dim lString As String
LString = LSet(myString, 10)   ' Returns "Left      "
LString = LSet(myString, 2)    ' Returns "Le"
LString = LSet(myString, 4)    ' Returns "Left"


Namespace: Microsoft.VisualBasic

Module: Strings

Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)

See Also

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