Caché MultiValue Basic Reference
SPACE
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Returns a string consisting of the specified number of spaces.
Synopsis
SPACE(number)
Arguments
number The number of spaces you want in the string. An expression that resolves to an integer.
Description
The SPACE function returns a string of the specified number of spaces.
If number is 0, a negative number, a 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 number is a decimal number, MVBasic truncates it to the integer portion.
You can use the SPACES function to return a dynamic array, each element of which contains the number of spaces specified for that element.
You can also insert spaces using tabbing. MVBasic sets default tab stops at 10-column intervals; this default is modifiable using the TABSTOP statement.
Examples
The following example uses the SPACE function to return a string with four spaces inserted in it:
PRINT "Hello":SPACE(4):"World"
See Also