String$

string$ returns a string containing a string repeated a given number of times.

Syntax

 string$(EXP_NB,EXP_STRING)string$(EXP_NB,EXP_CAR)

Examples

 # Returns the string "abc abc abc"MY_STRING=string$(3,"abc ")# Returns the string "AAAAA"MY_STRING=string$(5,65)# string$ returns a string (limited to 255 characters)# This statement does not trigger an error, but the result returned is 255MAXLEN=len(string$(500,45))

Description

string$(EXP_NB,EXP_STRING) returns a string containing EXP_NB times the string EXP_STRING.
string$(EXP_NB,EXP_CAR) returns a string containing EXP_NB times the character of code EXP_CAR.
This function is equivalent to string$(EXP_NB,chr$(EXP_CAR)).

The type of result is Char.

Comments

When EXP_NB is 0, EXP_CAR is 0, or EXP_STRING is "", the result is always the null string "".

Associated errors

Error codeDescription
10The first argument is not numeric, or the second argument has another type than numeric or string.
50The first argument is negative.

See also

space$, ascii, chr$, vireblc.