Skip to main content

SPACES

Returns a dynamic array consisting of the specified number of spaces for each element.

Synopsis

SPACES(dynarray)

Arguments

dynarray An expression that resolves to a dynamic array of positive integers, specifying the number of spaces you want in each corresponding element of the output dynamic array.

Description

The SPACES function returns a dynamic array, each element of which contains the number of spaces specified for that element.

If an element value is missing, or is 0, a negative number, the null string, or a non-numeric string, no spaces are returned. A string is parsed as a number until a non-numeric character is encountered. Thus “7dwarves” is parsed as 7. If an element value is a decimal number, SPACES truncates it to an integer.

You can use the SPACE function to return a single string of spaces. You can also insert spaces using tabbing. MVBasic sets default tab stops at 10-column intervals.

Examples

The following example uses the SPACES function to return a dynamic array, each element of which contains one additional space. It concatenates the string of spaces in each of these elements to a single-letter string from the letters dynamic array:

letters="A":@VM:"B":@VM:"C":@VM:"D":@VM:"E"
spaces=1:@VM:2:@VM:3:@VM:4:@VM:5
PRINT CATS(letters,SPACES(spaces))

See Also

FeedbackOpens in a new tab