Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Strings.Space(Int32) Method

Definition

Namespace:
Microsoft.VisualBasic
Assembly:
Microsoft.VisualBasic.Core.dll
Assembly:
Microsoft.VisualBasic.dll
Source:
Strings.vb
Source:
Strings.vb
Source:
Strings.vb
Source:
Strings.vb
Source:
Strings.vb

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Returns a string consisting of the specified number of spaces.

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

Parameters

Number
Int32

Required. Integer expression. The number of spaces you want in the string.

Returns

A string consisting of the specified number of spaces.

Exceptions

Number < 0.

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"

Remarks

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

Applies to

See also


Feedback

Was this page helpful?