Strings.LSet(String, Int32) 方法

定義

回傳一個左對齊的字串,包含調整至指定長度的指定字串。

public:
 static System::String ^ LSet(System::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

參數

Source
String

必須的。 String 表達式。 字串變數名稱。

Length
Int32

必須的。 Integer 表達式。 回送弦的長度。

傳回

一個左對齊的字串,包含指定字串並調整至指定長度。

範例

此範例展示了該函數的 LSet 使用。

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)

備註

若指定的字串長度超過指定長度,則返回的字串會縮短至指定長度。 若指定字串長度短於指定長度,則會在返回字串的右端加上空格,以產生適當的長度。

適用於

另請參閱