Редагувати

Поділитися через


Strings.LSet(String, Int32) Method

Definition

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

public:
 static System::String ^ LSet(System::String ^ Source, int Length);
public static string LSet (string? Source, int Length);
public static string LSet (string Source, int Length);
static member LSet : string * int -> string
Public Function LSet (Source As String, Length As Integer) As String

Parameters

Source
String

Required. String expression. Name of string variable.

Length
Int32

Required. Integer expression. Length of returned string.

Returns

A left-aligned string containing the specified string adjusted to the specified length.

Examples

This example demonstrates the use of the LSet function.

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

Remarks

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.

Applies to

See also