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"