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 式適用於格式化輸出和清除固定長度字串中的資料。

適用於

另請參閱