Space$
space$
returns a string containing a number of spaces given by its argument.
space$(EXP_NB)
EXP_NB
is an integer expression that returns the number of spaces in the returned string. # 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))
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.
space$(0)
returns the null string ""
.
Error code | Description |
---|---|
10 | The argument is not numeric. |
50 | The argument is negative. |
string$, ascii, chr$, vireblc.