46
CipherLab BASIC Programming Part I
4.4.7 CREATING STRINGS OF REPEATING CHARACTERS
STRING$
Purpose To return a string containing the specified number of the requested character.
Syntax A$ = STRING$(N%, J%)
A$ = STRING$(N%, X$)
Remarks “A$” is a string variable to be assigned to the result.
“N%”
is a numeric expression in the range of 0 to 255, indicating the number
of a character.
“J%”
is a numeric expression in the range of 0 to 255, indicating the ASCII
code of a character.
“X$” may be a string variable or string constant.
Example
IDX_LENGTH% = 20
Data$ = Name$ + STRING$(IDX_LENGTH% - LEN(Name$),“ ”)
ADD_RECORD$(1, Data$)
‘ padding with space if the length of Name$ is less than IDX_LENGTH%