Space$

space$ returns a string containing a number of spaces given by its argument.

Syntax

 space$(EXP_NB)

Examples

 # Format a string on 35 characters (left aligned, right aligned)MY_STRING="This is a string"If len(MY_STRING)<=35LEFT_ALIGNED=MY_STRING+space$(35-len(MY_STRING))RIGHT_ALIGNED=space$(35-len(MY_STRING))+MY_STRINGEndif# space$ returns a string (limited to 255 characters)# This statement does not trigger an error, but the result returned is 255MAXLEN=len(space$(500))

Description

space$(EXP_NB) returns a space containing EXP_NB spaces. This function is equivalent to string$(EXP_NB,32) or string$(EXP_NB," ").

The type of result is Char.

Comments

space$(0) returns the null string "".

Associated errors

Error codeDescription
10The argument is not numeric.
50The argument is negative.

See also

string$, ascii, chr$, vireblc.