Space 函式

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

語法

Space(number)

備註

number 引數是字串中所需的空格數。

下列範例使用 Space 函式來傳回由指定空格數所組成的字串:

範例

Dim MyString
MyString = Space (10)   ' Returns a string with 10 spaces.
MyString = "Hello" & Space (10) & "World" 
' Insert 10 spaces between two strings.
MyString = "Name:" & Space (5) & "John Doe"   
' Adds 5 spaces between "Name:" and "John Doe"
MyString = "Start" & Space (0) & "End"   
' No spaces added between "Start" and "End"