Condividi tramite


Strings.Space Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns a string consisting of the specified number of spaces.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

Syntax

'Declaration
Public Shared Function Space ( _
    Number As Integer _
) As String
public static string Space(
    int Number
)

Parameters

  • Number
    Type: System.Int32
    Required. Integer expression. The number of spaces you want in the string.

Return Value

Type: System.String
Returns a string consisting of the specified number of spaces.

Remarks

The Space function is useful for formatting output and clearing data in fixed-length strings.

Examples

This example uses the Space function to return a string consisting of a specified number of spaces.

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

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.