Strings.Space(Int32) 方法

定義

回傳一個由指定空格數組成的字串。

public:
 static System::String ^ Space(int Number);
public static string Space(int Number);
static member Space : int -> string
Public Function Space (Number As Integer) As String

參數

Number
Int32

必須的。 Integer 表達式。 你想要的字串空格數。

傳回

一個由指定空格數組成的字串。

例外狀況

Number < 0。

範例

此範例使用函 Space 式回傳由指定空格數組成的字串。

Dim testString As String
' Returns a string with 10 spaces.
testString = Space(10)
' Inserts 10 spaces between two strings.
testString = "Hello" & Space(10) & "World"

備註

Space 函式對於格式化輸出及清除固定長度字串中的資料非常有用。

適用於

另請參閱